Better support for bot accounts
This commit is contained in:
parent
2784920fa8
commit
fb5a52de3a
@ -50,11 +50,12 @@ namespace NadekoBot.Commands
|
|||||||
var com = NadekoBot.Client.GetService<CommandService>().AllCommands
|
var com = NadekoBot.Client.GetService<CommandService>().AllCommands
|
||||||
.FirstOrDefault(c => c.Text.ToLower().Equals(comToFind));
|
.FirstOrDefault(c => c.Text.ToLower().Equals(comToFind));
|
||||||
if (com != null)
|
if (com != null)
|
||||||
await e.Channel.SendMessage($"`Help for '{com.Text}:'` **{com.Description}**");
|
await e.Channel.SendMessage($"`Help for '{com.Text}':` **{com.Description}**");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string HelpString => $"You can use `{NadekoBot.Config.CommandPrefixes.Help}modules` command to see a list of all modules.\n" +
|
public static string HelpString => NadekoBot.IsBot ? $"To invite {NadekoBot.Client.CurrentUser.Name} to your server, go here: <>\n" : "" +
|
||||||
|
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}modules` command to see a list of all modules.\n" +
|
||||||
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}commands ModuleName`" +
|
$"You can use `{NadekoBot.Config.CommandPrefixes.Help}commands ModuleName`" +
|
||||||
$" (for example `{NadekoBot.Config.CommandPrefixes.Help}commands Administration`) to see a list of all of the commands in that module.\n" +
|
$" (for example `{NadekoBot.Config.CommandPrefixes.Help}commands Administration`) to see a list of all of the commands in that module.\n" +
|
||||||
$"For a specific command help, use `{NadekoBot.Config.CommandPrefixes.Help}h \"Command name\"` (for example `-h \"!m q\"`)\n" +
|
$"For a specific command help, use `{NadekoBot.Config.CommandPrefixes.Help}h \"Command name\"` (for example `-h \"!m q\"`)\n" +
|
||||||
@ -121,11 +122,11 @@ Version: `{NadekoStats.Instance.BotVersion}`";
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await e.Channel.SendMessage(
|
await e.Channel.SendMessage(
|
||||||
@"I've created a **paypal** email for nadeko, so if you wish to support the project, you can send your donations to `nadekodiscordbot@gmail.com`
|
$@"I've created a **paypal** email for nadeko, so if you wish to support the project, you can send your donations to `nadekodiscordbot@gmail.com`
|
||||||
Don't forget to leave your discord name or id in the message, so that I can reward people who help out.
|
Don't forget to leave your discord name or id in the message, so that I can reward people who help out.
|
||||||
You can join nadekobot server by simply private messaging NadekoBot, and you will get an invite.
|
You can join nadekobot server by typing {Module.Prefix}h and you will get an invite in a private message.
|
||||||
|
|
||||||
*If you want to support in some other way or on a different platform, please message me there*"
|
*If you want to support in some other way or on a different platform, please message me*"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,33 @@
|
|||||||
using System.Linq;
|
using Discord.Commands;
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using Discord.Commands;
|
|
||||||
using NadekoBot.Commands;
|
using NadekoBot.Commands;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace NadekoBot.Modules {
|
namespace NadekoBot.Modules
|
||||||
internal class Help : DiscordModule {
|
{
|
||||||
|
internal class Help : DiscordModule
|
||||||
|
{
|
||||||
|
|
||||||
public Help() {
|
public Help()
|
||||||
|
{
|
||||||
commands.Add(new HelpCommand(this));
|
commands.Add(new HelpCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Help;
|
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Help;
|
||||||
|
|
||||||
public override void Install(ModuleManager manager) {
|
public override void Install(ModuleManager manager)
|
||||||
manager.CreateCommands("", cgb => {
|
{
|
||||||
|
manager.CreateCommands("", cgb =>
|
||||||
|
{
|
||||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||||
commands.ForEach(com => com.Init(cgb));
|
commands.ForEach(com => com.Init(cgb));
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "modules")
|
cgb.CreateCommand(Prefix + "modules")
|
||||||
.Alias(".modules")
|
.Alias(".modules")
|
||||||
.Description("List all bot modules.")
|
.Description("List all bot modules.")
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.Client.GetService<ModuleService>().Modules.Select(m => m.Name)));
|
await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.Client.GetService<ModuleService>().Modules.Select(m => m.Name)));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -29,11 +35,13 @@ namespace NadekoBot.Modules {
|
|||||||
.Alias(".commands")
|
.Alias(".commands")
|
||||||
.Description("List all of the bot's commands from a certain module.")
|
.Description("List all of the bot's commands from a certain module.")
|
||||||
.Parameter("module", ParameterType.Unparsed)
|
.Parameter("module", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands
|
var cmds = NadekoBot.Client.GetService<CommandService>().AllCommands
|
||||||
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
|
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
|
||||||
var cmdsArray = cmds as Command[] ?? cmds.ToArray();
|
var cmdsArray = cmds as Command[] ?? cmds.ToArray();
|
||||||
if (!cmdsArray.Any()) {
|
if (!cmdsArray.Any())
|
||||||
|
{
|
||||||
await e.Channel.SendMessage("That module does not exist.");
|
await e.Channel.SendMessage("That module does not exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ namespace NadekoBot
|
|||||||
public static LocalizedStrings Locale { get; set; } = new LocalizedStrings();
|
public static LocalizedStrings Locale { get; set; } = new LocalizedStrings();
|
||||||
public static string BotMention { get; set; } = "";
|
public static string BotMention { get; set; } = "";
|
||||||
public static bool Ready { get; set; } = false;
|
public static bool Ready { get; set; } = false;
|
||||||
|
public static bool IsBot { get; set; } = false;
|
||||||
|
|
||||||
private static Channel OwnerPrivateChannel { get; set; }
|
private static Channel OwnerPrivateChannel { get; set; }
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if password is not entered, prompt for password
|
//if password is not entered, prompt for password
|
||||||
if (string.IsNullOrWhiteSpace(Creds.Password) && !string.IsNullOrWhiteSpace(Creds.Token))
|
if (string.IsNullOrWhiteSpace(Creds.Password) && string.IsNullOrWhiteSpace(Creds.Token))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Password blank. Please enter your password:\n");
|
Console.WriteLine("Password blank. Please enter your password:\n");
|
||||||
Creds.Password = Console.ReadLine();
|
Creds.Password = Console.ReadLine();
|
||||||
@ -185,7 +186,11 @@ namespace NadekoBot
|
|||||||
if (string.IsNullOrWhiteSpace(Creds.Token))
|
if (string.IsNullOrWhiteSpace(Creds.Token))
|
||||||
await Client.Connect(Creds.Username, Creds.Password);
|
await Client.Connect(Creds.Username, Creds.Password);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
await Client.Connect(Creds.Token);
|
await Client.Connect(Creds.Token);
|
||||||
|
IsBot = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -197,6 +202,7 @@ namespace NadekoBot
|
|||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("-----------------");
|
Console.WriteLine("-----------------");
|
||||||
Console.WriteLine(await NadekoStats.Instance.GetStats());
|
Console.WriteLine(await NadekoStats.Instance.GetStats());
|
||||||
Console.WriteLine("-----------------");
|
Console.WriteLine("-----------------");
|
||||||
@ -218,8 +224,6 @@ namespace NadekoBot
|
|||||||
if (string.IsNullOrWhiteSpace(request.Content))
|
if (string.IsNullOrWhiteSpace(request.Content))
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//await Task.Delay(90000);
|
|
||||||
Classes.Permissions.PermissionsHandler.Initialize();
|
Classes.Permissions.PermissionsHandler.Initialize();
|
||||||
NadekoBot.Ready = true;
|
NadekoBot.Ready = true;
|
||||||
});
|
});
|
||||||
@ -245,7 +249,7 @@ namespace NadekoBot
|
|||||||
if (ConfigHandler.IsBlackListed(e))
|
if (ConfigHandler.IsBlackListed(e))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!NadekoBot.Config.DontJoinServers)
|
if (!NadekoBot.Config.DontJoinServers && !IsBot)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user