More work on moving to beta2, almost done

This commit is contained in:
Kwoth
2016-12-21 09:33:47 +01:00
parent caef908a0e
commit 5b55ab6775
27 changed files with 109 additions and 66 deletions

View File

@@ -197,7 +197,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task AntiRaid(IUserMessage imsg, int userThreshold, int seconds, PunishmentAction action)
public async Task AntiRaid(int userThreshold, int seconds, PunishmentAction action)
{
if (userThreshold < 2 || userThreshold > 30)
{
@@ -239,7 +239,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)]
public async Task AntiSpam(IUserMessage imsg, int messageCount=3, PunishmentAction action = PunishmentAction.Mute)
public async Task AntiSpam(int messageCount=3, PunishmentAction action = PunishmentAction.Mute)
{
if (messageCount < 2 || messageCount > 10)
return;

View File

@@ -46,7 +46,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageRoles)]
public async Task AutoAssignRole(IUserMessage umsg, [Remainder] IRole role = null)
public async Task AutoAssignRole([Remainder] IRole role = null)
{
GuildConfig conf;
using (var uow = DbHandler.UnitOfWork())

View File

@@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageGuild)]
public async Task Jcsc(IUserMessage imsg, int token)
public async Task Jcsc(int token)
{
ConcurrentHashSet<ITextChannel> set;
if (!Subscribers.TryGetValue(token, out set))

View File

@@ -748,7 +748,7 @@ namespace NadekoBot.Modules.Administration
//[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
//[RequireContext(ContextType.Guild)]
//public async Task VoiPresIgnore(IUserMessage imsg, IVoiceChannel voiceChannel)
//public async Task VoiPresIgnore(IVoiceChannel voiceChannel)
//{
// //var channel = (ITextChannel)Context.Channel;
// int removed;

View File

@@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageMessages)]
public async Task Repeat(IUserMessage imsg, int minutes, [Remainder] string message)
public async Task Repeat(int minutes, [Remainder] string message)
{
if (minutes < 1 || minutes > 10080)
return;

View File

@@ -136,7 +136,7 @@ namespace NadekoBot.Modules.Administration
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageRoles)]
[Priority(1)]
public async Task SetMuteRole(IUserMessage imsg, [Remainder] string name)
public async Task SetMuteRole([Remainder] string name)
{
//var channel = (ITextChannel)Context.Channel;
name = name.Trim();
@@ -158,7 +158,7 @@ namespace NadekoBot.Modules.Administration
[RequireUserPermission(GuildPermission.ManageRoles)]
[Priority(0)]
public Task SetMuteRole([Remainder] IRole role)
=> SetMuteRole(Context.Message, role.Name);
=> SetMuteRole(role.Name);
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]

View File

@@ -104,7 +104,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[OwnerOnly]
public async Task AddPlaying(IUserMessage umsg, [Remainder] string status)
public async Task AddPlaying([Remainder] string status)
{
using (var uow = DbHandler.UnitOfWork())
{
@@ -134,7 +134,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[OwnerOnly]
public async Task RemovePlaying(IUserMessage umsg, int index)
public async Task RemovePlaying(int index)
{
index -= 1;

View File

@@ -362,7 +362,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.ManageGuild)]
public async Task ByeDel(IUserMessage umsg, int timer = 30)
public async Task ByeDel(int timer = 30)
{
await ServerGreetCommands.SetByeDel(Context.Guild.Id, timer).ConfigureAwait(false);

View File

@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task CreateWar(IUserMessage umsg, int size, [Remainder] string enemyClan = null)
public async Task CreateWar(int size, [Remainder] string enemyClan = null)
{
if (!(Context.User as IGuildUser).GuildPermissions.ManageChannels)
return;
@@ -88,12 +88,12 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task StartWar(IUserMessage umsg, [Remainder] string number = null)
public async Task StartWar([Remainder] string number = null)
{
int num = 0;
int.TryParse(number, out num);
var warsInfo = GetWarInfo(umsg, Context.Guild, num);
var warsInfo = GetWarInfo(Context.Guild, num);
if (warsInfo == null)
{
await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false);
@@ -114,7 +114,7 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task ListWar(IUserMessage umsg, [Remainder] string number = null)
public async Task ListWar([Remainder] string number = null)
{
// if number is null, print all wars in a short way
@@ -145,7 +145,7 @@ namespace NadekoBot.Modules.ClashOfClans
var num = 0;
int.TryParse(number, out num);
//if number is not null, print the war needed
var warsInfo = GetWarInfo(umsg, Context.Guild, num);
var warsInfo = GetWarInfo(Context.Guild, num);
if (warsInfo == null)
{
await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false);
@@ -156,9 +156,9 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Claim(IUserMessage umsg, int number, int baseNumber, [Remainder] string other_name = null)
public async Task Claim(int number, int baseNumber, [Remainder] string other_name = null)
{
var warsInfo = GetWarInfo(umsg, Context.Guild, number);
var warsInfo = GetWarInfo(Context.Guild, number);
if (warsInfo == null || warsInfo.Item1.Count == 0)
{
await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false);
@@ -206,7 +206,7 @@ namespace NadekoBot.Modules.ClashOfClans
[RequireContext(ContextType.Guild)]
public async Task EndWar(int number)
{
var warsInfo = GetWarInfo(Context.Message, Context.Guild, number);
var warsInfo = GetWarInfo(Context.Guild, number);
if (warsInfo == null)
{
await Context.Channel.SendErrorAsync("🔰 That war does not exist.").ConfigureAwait(false);
@@ -223,9 +223,9 @@ namespace NadekoBot.Modules.ClashOfClans
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Unclaim(IUserMessage umsg, int number, [Remainder] string otherName = null)
public async Task Unclaim(int number, [Remainder] string otherName = null)
{
var warsInfo = GetWarInfo(umsg, Context.Guild, number);
var warsInfo = GetWarInfo(Context.Guild, number);
if (warsInfo == null || warsInfo.Item1.Count == 0)
{
await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false);
@@ -250,7 +250,7 @@ namespace NadekoBot.Modules.ClashOfClans
private async Task FinishClaim(int number, int baseNumber, int stars = 3)
{
var warInfo = GetWarInfo(Context.Message, Context.Guild, number);
var warInfo = GetWarInfo(Context.Guild, number);
if (warInfo == null || warInfo.Item1.Count == 0)
{
await Context.Channel.SendErrorAsync("🔰 **That war does not exist.**").ConfigureAwait(false);
@@ -276,7 +276,7 @@ namespace NadekoBot.Modules.ClashOfClans
}
}
private static Tuple<List<ClashWar>, int> GetWarInfo(IUserMessage umsg, IGuild guild, int num)
private static Tuple<List<ClashWar>, int> GetWarInfo(IGuild guild, int num)
{
List<ClashWar> wars = null;
ClashWars.TryGetValue(guild.Id, out wars);

View File

@@ -206,7 +206,7 @@ namespace NadekoBot.Modules.CustomReactions
}
[NadekoCommand, Usage, Description, Aliases]
public async Task ShowCustReact(IUserMessage imsg, int id)
public async Task ShowCustReact(int id)
{
ConcurrentHashSet<CustomReaction> customReactions;
if (Context.Guild == null)
@@ -229,7 +229,7 @@ namespace NadekoBot.Modules.CustomReactions
}
[NadekoCommand, Usage, Description, Aliases]
public async Task DelCustReact(IUserMessage imsg, int id)
public async Task DelCustReact(int id)
{
if ((Context.Guild == null && !NadekoBot.Credentials.IsOwner(Context.User)) || (Context.Guild != null && !((IGuildUser)Context.User).GuildPermissions.Administrator))
{
@@ -268,7 +268,7 @@ namespace NadekoBot.Modules.CustomReactions
}
[NadekoCommand, Usage, Description, Aliases]
public async Task CrStatsClear(IUserMessage imsg, string trigger = null)
public async Task CrStatsClear(string trigger = null)
{
if (string.IsNullOrWhiteSpace(trigger))
{
@@ -290,7 +290,7 @@ namespace NadekoBot.Modules.CustomReactions
}
[NadekoCommand, Usage, Description, Aliases]
public async Task CrStats(IUserMessage imsg, int page = 1)
public async Task CrStats(int page = 1)
{
if (page < 1)
return;

View File

@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Gambling
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task JoinRace(IUserMessage umsg, int amount = 0)
public async Task JoinRace(int amount = 0)
{
if (amount < 0)
amount = 0;

View File

@@ -22,7 +22,7 @@ namespace NadekoBot.Modules.Gambling
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Flip(IUserMessage imsg, int count = 1)
public async Task Flip(int count = 1)
{
//var channel = (ITextChannel)Context.Channel;
if (count == 1)
@@ -50,7 +50,7 @@ namespace NadekoBot.Modules.Gambling
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Betflip(IUserMessage umsg, int amount, string guess)
public async Task Betflip(int amount, string guess)
{
//var channel = (ITextChannel)Context.Channel;
var guildUser = (IGuildUser)Context.User;

View File

@@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Games
[NadekoCommand, Usage, Description, Aliases]
[RequireUserPermission(GuildPermission.ManageMessages)]
[RequireContext(ContextType.Guild)]
public Task PublicPoll(IUserMessage umsg, [Remainder] string arg = null)
public Task PublicPoll([Remainder] string arg = null)
=> InternalStartPoll(arg, isPublic: true);
private async Task InternalStartPoll(string arg, bool isPublic = false)

View File

@@ -38,12 +38,14 @@ namespace NadekoBot.Modules.Help
public async Task Modules()
{
await Context.Channel.SendMessageAsync("📜 **List of modules:** ```css\n• " + string.Join("\n• ", NadekoBot.CommandService.Modules.Select(m => m.Name)) + $"\n``` **Type** `-commands module_name` **to get a list of commands in that module.** ***e.g.*** `-commands games`")
await Context.Channel.SendMessageAsync("📜 **List of modules:** ```css\n• " + string.Join("\n• ",
NadekoBot.CommandService.Modules.GroupBy(mi => mi.GetTopLevelModule()).Select(m => m.Key.Name).OrderBy(m => m)) +
$"\n``` **Type** `-commands module_name` **to get a list of commands in that module.** ***e.g.*** `-commands games`")
.ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
public async Task Commands(IUserMessage umsg, [Remainder] string module = null)
public async Task Commands([Remainder] string module = null)
{
var channel = Context.Channel;
@@ -73,7 +75,7 @@ namespace NadekoBot.Modules.Help
}
[NadekoCommand, Usage, Description, Aliases]
public async Task H(IUserMessage umsg, [Remainder] string comToFind = null)
public async Task H([Remainder] string comToFind = null)
{
var channel = Context.Channel;
@@ -142,7 +144,7 @@ namespace NadekoBot.Modules.Help
helpstr.AppendLine("----------------|--------------|-------");
lastModule = com.Module.Name;
}
helpstr.AppendLine($"{string.Join(" ", com.Aliases.Select(a => "`" + a + "`"))} | {string.Format(com.Summary, com.Module.Prefix)} {GetCommandRequirements(com)} | {string.Format(com.Remarks, com.Module.Prefix)}");
helpstr.AppendLine($"{string.Join(" ", com.Aliases.Select(a => "`" + a + "`"))} | {string.Format(com.Summary, com.Module.GetPrefix())} {GetCommandRequirements(com)} | {string.Format(com.Remarks, com.Module.GetPrefix())}");
}
helpstr = helpstr.Replace(NadekoBot.Client.CurrentUser().Username , "@BotName");
File.WriteAllText("../../docs/Commands List.md", helpstr.ToString());

View File

@@ -214,7 +214,7 @@ namespace NadekoBot.Modules.NSFW
if (matches.Count == 0)
return null;
return matches[rng.Next(0, matches.Count)].Groups["ll"].Value;
return "http:" + matches[rng.Next(0, matches.Count)].Groups["ll"].Value;
}
}

View File

@@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Permissions
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task CmdCooldown(IUserMessage imsg, CommandInfo command, int secs)
public async Task CmdCooldown(CommandInfo command, int secs)
{
var channel = (ITextChannel)Context.Channel;
if (secs < 0 || secs > 3600)

View File

@@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Permissions
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task FilterWord(IUserMessage imsg, [Remainder] string word)
public async Task FilterWord([Remainder] string word)
{
var channel = (ITextChannel)Context.Channel;

View File

@@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Searches
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Anime(IUserMessage umsg, [Remainder] string query)
public async Task Anime([Remainder] string query)
{
var channel = (ITextChannel)Context.Channel;
@@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Searches
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task Manga(IUserMessage umsg, [Remainder] string query)
public async Task Manga([Remainder] string query)
{
var channel = (ITextChannel)Context.Channel;

View File

@@ -105,7 +105,7 @@ namespace NadekoBot.Modules.Searches
// public override void Init(CommandGroupBuilder cgb)
// {
// cgb.CreateCommand(Module.Prefix + "lolchamp")
// cgb.CreateCommand(Module.Name + "lolchamp")
// .Description($"Shows League Of Legends champion statistics. If there are spaces/apostrophes or in the name - omit them. Optional second parameter is a role. |`{Prefix}lolchamp Riven` or `{Prefix}lolchamp Annie sup`")
// .Parameter("champ", ParameterType.Required)
// .Parameter("position", ParameterType.Unparsed)

View File

@@ -268,7 +268,7 @@ namespace NadekoBot.Modules.Searches
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task CheckStream(IUserMessage imsg, FollowedStream.FollowedStreamType platform, [Remainder] string username)
public async Task CheckStream(FollowedStream.FollowedStreamType platform, [Remainder] string username)
{
var stream = username?.Trim();
if (string.IsNullOrWhiteSpace(stream))

View File

@@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Searches
}
[NadekoCommand, Usage, Description, Aliases]
public async Task Translate(IUserMessage umsg, string langs, [Remainder] string text = null)
public async Task Translate(string langs, [Remainder] string text = null)
{
try
{

View File

@@ -100,7 +100,7 @@ namespace NadekoBot.Modules.Utility
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async Task Remind(IUserMessage umsg, MeOrHere meorhere, string timeStr, [Remainder] string message)
public async Task Remind(MeOrHere meorhere, string timeStr, [Remainder] string message)
{
IMessageChannel target;
if (meorhere == MeOrHere.Me)
@@ -111,13 +111,13 @@ namespace NadekoBot.Modules.Utility
{
target = Context.Channel;
}
await Remind(umsg, target, timeStr, message).ConfigureAwait(false);
await Remind(target, timeStr, message).ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async Task Remind(IUserMessage umsg, IMessageChannel ch, string timeStr, [Remainder] string message)
public async Task Remind(IMessageChannel ch, string timeStr, [Remainder] string message)
{
var channel = (ITextChannel)Context.Channel;
@@ -193,7 +193,7 @@ namespace NadekoBot.Modules.Utility
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async Task RemindTemplate(IUserMessage umsg, [Remainder] string arg)
public async Task RemindTemplate([Remainder] string arg)
{
var channel = (ITextChannel)Context.Channel;

View File

@@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Utility
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
public async Task ListServers(IUserMessage imsg, int page = 1)
public async Task ListServers(int page = 1)
{
var channel = (ITextChannel)Context.Channel;