added prefix placeholders

This commit is contained in:
Master Kwoth 2016-03-04 13:08:06 +01:00
parent d889c61911
commit bc6e751e5f
10 changed files with 49 additions and 30 deletions

View File

@ -21,6 +21,8 @@ namespace NadekoBot.Modules {
commands.Add(new RequestsCommand()); commands.Add(new RequestsCommand());
} }
public override string Prefix { get; } = String.Format("<@{0}>", NadekoBot.Creds.BotId);
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
var rng = new Random(); var rng = new Random();

View File

@ -6,6 +6,8 @@ namespace NadekoBot.Modules {
internal abstract class DiscordModule : IModule { internal abstract class DiscordModule : IModule {
protected readonly HashSet<IDiscordCommand> commands = new HashSet<IDiscordCommand>(); protected readonly HashSet<IDiscordCommand> commands = new HashSet<IDiscordCommand>();
public abstract string Prefix { get; }
public abstract void Install(ModuleManager manager); public abstract void Install(ModuleManager manager);
} }
} }

View File

@ -16,6 +16,8 @@ namespace NadekoBot.Modules
commands.Add(new DiceRollCommand()); commands.Add(new DiceRollCommand());
} }
public override string Prefix { get; } = "$";
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
manager.CreateCommands("", cgb => manager.CreateCommands("", cgb =>

View File

@ -22,6 +22,8 @@ namespace NadekoBot.Modules {
_8BallAnswers = JArray.Parse(File.ReadAllText("data/8ball.json")).Select(t => t.ToString()).ToArray(); _8BallAnswers = JArray.Parse(File.ReadAllText("data/8ball.json")).Select(t => t.ToString()).ToArray();
} }
public override string Prefix { get; } = ">";
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
manager.CreateCommands("", cgb => { manager.CreateCommands("", cgb => {

View File

@ -11,6 +11,8 @@ namespace NadekoBot.Modules {
commands.Add(new HelpCommand()); commands.Add(new HelpCommand());
} }
public override string Prefix { get; } = "-";
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);

View File

@ -32,6 +32,8 @@ namespace NadekoBot.Modules {
} }
public override string Prefix { get; } = "!m ";
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
var client = NadekoBot.Client; var client = NadekoBot.Client;

View File

@ -9,6 +9,8 @@ namespace NadekoBot.Modules {
private readonly Random rng = new Random(); private readonly Random rng = new Random();
public override string Prefix { get; } = "~";
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
manager.CreateCommands("", cgb => { manager.CreateCommands("", cgb => {

View File

@ -9,12 +9,13 @@ using NadekoBot.Extensions;
namespace NadekoBot.Modules { namespace NadekoBot.Modules {
internal class PermissionModule : DiscordModule { internal class PermissionModule : DiscordModule {
private const string prefix = ";"; public override string Prefix { get; } = ";";
public PermissionModule() { public PermissionModule() {
//Empty for now //Empty for now
} }
//todo word filtering/invite bans (?:discord(?:\.gg|app\.com\/invite)\/(?<id>([\w]{16}|(?:[\w]+-?){3}))) //todo word filtering/invite bans (?:discord(?:\.gg|app\.com\/invite)\/(?<id>([\w]{16}|(?:[\w]+-?){3})))
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
manager.CreateCommands("", cgb => { manager.CreateCommands("", cgb => {
@ -22,8 +23,8 @@ namespace NadekoBot.Modules {
commands.ForEach(cmd => cmd.Init(cgb)); commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(prefix + "permrole") cgb.CreateCommand(Prefix + "permrole")
.Alias(prefix + "pr") .Alias(Prefix + "pr")
.Description("Sets a role which can change permissions. Or supply no parameters to find out the current one. Default one is 'Nadeko'.") .Description("Sets a role which can change permissions. Or supply no parameters to find out the current one. Default one is 'Nadeko'.")
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -45,8 +46,8 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions."); await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.");
}); });
cgb.CreateCommand(prefix + "verbose") cgb.CreateCommand(Prefix + "verbose")
.Alias(prefix + "v") .Alias(Prefix + "v")
.Description("Sets whether to show when a command/module is blocked.\n**Usage**: ;verbose true") .Description("Sets whether to show when a command/module is blocked.\n**Usage**: ;verbose true")
.Parameter("arg", ParameterType.Required) .Parameter("arg", ParameterType.Required)
.Do(async e => { .Do(async e => {
@ -56,8 +57,8 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage($"Verbosity set to {val}."); await e.Channel.SendMessage($"Verbosity set to {val}.");
}); });
cgb.CreateCommand(prefix + "serverperms") cgb.CreateCommand(Prefix + "serverperms")
.Alias(prefix + "sp") .Alias(Prefix + "sp")
.Description("Shows banned permissions for this server.") .Description("Shows banned permissions for this server.")
.Do(async e => { .Do(async e => {
var perms = PermsHandler.GetServerPermissions(e.Server); var perms = PermsHandler.GetServerPermissions(e.Server);
@ -66,8 +67,8 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage(perms.ToString()); await e.Channel.SendMessage(perms.ToString());
}); });
cgb.CreateCommand(prefix + "roleperms") cgb.CreateCommand(Prefix + "roleperms")
.Alias(prefix + "rp") .Alias(Prefix + "rp")
.Description("Shows banned permissions for a certain role. No argument means for everyone.\n**Usage**: ;rp AwesomeRole") .Description("Shows banned permissions for a certain role. No argument means for everyone.\n**Usage**: ;rp AwesomeRole")
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -88,8 +89,8 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage(perms.ToString()); await e.Channel.SendMessage(perms.ToString());
}); });
cgb.CreateCommand(prefix + "channelperms") cgb.CreateCommand(Prefix + "channelperms")
.Alias(prefix + "cp") .Alias(Prefix + "cp")
.Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev") .Description("Shows banned permissions for a certain channel. No argument means for this channel.\n**Usage**: ;cp #dev")
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -109,8 +110,8 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage(perms.ToString()); await e.Channel.SendMessage(perms.ToString());
}); });
cgb.CreateCommand(prefix + "userperms") cgb.CreateCommand(Prefix + "userperms")
.Alias(prefix + "up") .Alias(Prefix + "up")
.Description("Shows banned permissions for a certain user. No argument means for yourself.\n**Usage**: ;up Kwoth") .Description("Shows banned permissions for a certain user. No argument means for yourself.\n**Usage**: ;up Kwoth")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -129,7 +130,7 @@ namespace NadekoBot.Modules {
await e.Channel.SendMessage(perms.ToString()); await e.Channel.SendMessage(perms.ToString());
}); });
cgb.CreateCommand(prefix + "sm").Alias(prefix + "servermodule") cgb.CreateCommand(Prefix + "sm").Alias(Prefix + "servermodule")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable") .Description("Sets a module's permission at the server level.\n**Usage**: ;sm [module_name] enable")
@ -147,7 +148,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "sc").Alias(prefix + "servercommand") cgb.CreateCommand(Prefix + "sc").Alias(Prefix + "servercommand")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable") .Description("Sets a command's permission at the server level.\n**Usage**: ;sc [command_name] disable")
@ -165,7 +166,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "rm").Alias(prefix + "rolemodule") cgb.CreateCommand(Prefix + "rm").Alias(Prefix + "rolemodule")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -193,7 +194,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "rc").Alias(prefix + "rolecommand") cgb.CreateCommand(Prefix + "rc").Alias(Prefix + "rolecommand")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
@ -221,7 +222,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "cm").Alias(prefix + "channelmodule") cgb.CreateCommand(Prefix + "cm").Alias(Prefix + "channelmodule")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -249,7 +250,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "cc").Alias(prefix + "channelcommand") cgb.CreateCommand(Prefix + "cc").Alias(Prefix + "channelcommand")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -277,7 +278,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "um").Alias(prefix + "usermodule") cgb.CreateCommand(Prefix + "um").Alias(Prefix + "usermodule")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -297,7 +298,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "uc").Alias(prefix + "usercommand") cgb.CreateCommand(Prefix + "uc").Alias(Prefix + "usercommand")
.Parameter("command", ParameterType.Required) .Parameter("command", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
@ -317,7 +318,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "asm").Alias(prefix + "allservermodules") cgb.CreateCommand(Prefix + "asm").Alias(Prefix + "allservermodules")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]") .Description("Sets permissions for all modules at the server level.\n**Usage**: ;asm [enable/disable]")
.Do(async e => { .Do(async e => {
@ -335,7 +336,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "asc").Alias(prefix + "allservercommands") cgb.CreateCommand(Prefix + "asc").Alias(Prefix + "allservercommands")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]") .Description("Sets permissions for all commands from a certain module at the server level.\n**Usage**: ;asc [module_name] [enable/disable]")
@ -355,7 +356,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "acm").Alias(prefix + "allchannelmodules") cgb.CreateCommand(Prefix + "acm").Alias(Prefix + "allchannelmodules")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]") .Description("Sets permissions for all modules at the channel level.\n**Usage**: ;acm [enable/disable] [channel_name]")
@ -375,7 +376,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "acc").Alias(prefix + "allchannelcommands") cgb.CreateCommand(Prefix + "acc").Alias(Prefix + "allchannelcommands")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -396,7 +397,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "arm").Alias(prefix + "allrolemodules") cgb.CreateCommand(Prefix + "arm").Alias(Prefix + "allrolemodules")
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("role", ParameterType.Unparsed) .Parameter("role", ParameterType.Unparsed)
.Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]") .Description("Sets permissions for all modules at the role level.\n**Usage**: ;arm [enable/disable] [role_name]")
@ -416,7 +417,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "arc").Alias(prefix + "allrolecommands") cgb.CreateCommand(Prefix + "arc").Alias(Prefix + "allrolecommands")
.Parameter("module", ParameterType.Required) .Parameter("module", ParameterType.Required)
.Parameter("bool", ParameterType.Required) .Parameter("bool", ParameterType.Required)
.Parameter("channel", ParameterType.Unparsed) .Parameter("channel", ParameterType.Unparsed)
@ -437,7 +438,7 @@ namespace NadekoBot.Modules {
} }
}); });
cgb.CreateCommand(prefix + "ubl") cgb.CreateCommand(Prefix + "ubl")
.Description("Blacklists a mentioned user.\n**Usage**: ;ubl [user_mention]") .Description("Blacklists a mentioned user.\n**Usage**: ;ubl [user_mention]")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -450,7 +451,7 @@ namespace NadekoBot.Modules {
}); });
}); });
cgb.CreateCommand(prefix + "ucl") cgb.CreateCommand(Prefix + "ucl")
.Description("Blacklists a mentioned channel (#general for example).\n**Usage**: ;ubl [channel_mention]") .Description("Blacklists a mentioned channel (#general for example).\n**Usage**: ;ubl [channel_mention]")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
@ -463,7 +464,7 @@ namespace NadekoBot.Modules {
}); });
}); });
cgb.CreateCommand(prefix + "usl") cgb.CreateCommand(Prefix + "usl")
.Description("Blacklists a server by a name or id (#general for example).\n**Usage**: ;usl [servername/serverid]") .Description("Blacklists a server by a name or id (#general for example).\n**Usage**: ;usl [servername/serverid]")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {

View File

@ -19,6 +19,8 @@ namespace NadekoBot.Modules {
rng = new Random(); rng = new Random();
} }
public override string Prefix { get; } = "~";
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
manager.CreateCommands("", cgb => { manager.CreateCommands("", cgb => {

View File

@ -11,6 +11,8 @@ using Action = Manatee.Trello.Action;
namespace NadekoBot.Modules { namespace NadekoBot.Modules {
internal class Trello : DiscordModule { internal class Trello : DiscordModule {
private readonly Timer t = new Timer() { Interval = 2000 }; private readonly Timer t = new Timer() { Interval = 2000 };
public override string Prefix { get; } = "trello";
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager) {
var client = manager.Client; var client = manager.Client;