Simplified sending, more gambling done but commented out (needs DB)

This commit is contained in:
Kwoth 2016-08-20 16:33:18 +02:00
parent 5de1bd5600
commit 68454a7b2f
42 changed files with 588 additions and 588 deletions

View File

@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Administration
//{ //{
// var channel = imsg.Channel as ITextChannel; // var channel = imsg.Channel as ITextChannel;
// await imsg.Channel.SendMessageAsync("`Restarting in 2 seconds...`"); // await channel.SendMessageAsync("`Restarting in 2 seconds...`");
// await Task.Delay(2000); // await Task.Delay(2000);
// System.Diagnostics.Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location); // System.Diagnostics.Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location);
// Environment.Exit(0); // Environment.Exit(0);
@ -48,9 +48,9 @@ namespace NadekoBot.Modules.Administration
// conf.AutoDeleteMessagesOnCommand = !conf.AutoDeleteMessagesOnCommand; // conf.AutoDeleteMessagesOnCommand = !conf.AutoDeleteMessagesOnCommand;
// await Classes.JSONModels.ConfigHandler.SaveConfig().ConfigureAwait(false); // await Classes.JSONModels.ConfigHandler.SaveConfig().ConfigureAwait(false);
// if (conf.AutoDeleteMessagesOnCommand) // if (conf.AutoDeleteMessagesOnCommand)
// await imsg.Channel.SendMessageAsync("❗`Now automatically deleting successfull command invokations.`"); // await channel.SendMessageAsync("❗`Now automatically deleting successfull command invokations.`");
// else // else
// await imsg.Channel.SendMessageAsync("❗`Stopped automatic deletion of successfull command invokations.`"); // await channel.SendMessageAsync("❗`Stopped automatic deletion of successfull command invokations.`");
//} //}
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -62,11 +62,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await usr.AddRolesAsync(role).ConfigureAwait(false); await usr.AddRolesAsync(role).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully added role **{role.Name}** to user **{usr.Username}**").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully added role **{role.Name}** to user **{usr.Username}**").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Failed to add roles. Bot has insufficient permissions.\n").ConfigureAwait(false); await channel.SendMessageAsync("Failed to add roles. Bot has insufficient permissions.\n").ConfigureAwait(false);
Console.WriteLine(ex.ToString()); Console.WriteLine(ex.ToString());
} }
} }
@ -79,11 +79,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await usr.RemoveRolesAsync(role).ConfigureAwait(false); await usr.RemoveRolesAsync(role).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully removed role **{role.Name}** from user **{usr.Username}**").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully removed role **{role.Name}** from user **{usr.Username}**").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Failed to remove roles. Most likely reason: Insufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Failed to remove roles. Most likely reason: Insufficient permissions.").ConfigureAwait(false);
} }
} }
@ -97,15 +97,15 @@ namespace NadekoBot.Modules.Administration
{ {
if (roleToEdit.Position > (await channel.Guild.GetCurrentUserAsync().ConfigureAwait(false)).Roles.Max(r => r.Position)) if (roleToEdit.Position > (await channel.Guild.GetCurrentUserAsync().ConfigureAwait(false)).Roles.Max(r => r.Position))
{ {
await imsg.Channel.SendMessageAsync("You can't edit roles higher than your highest role.").ConfigureAwait(false); await channel.SendMessageAsync("You can't edit roles higher than your highest role.").ConfigureAwait(false);
return; return;
} }
await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false); await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("Role renamed.").ConfigureAwait(false); await channel.SendMessageAsync("Role renamed.").ConfigureAwait(false);
} }
catch (Exception) catch (Exception)
{ {
await imsg.Channel.SendMessageAsync("Failed to rename role. Probably insufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Failed to rename role. Probably insufficient permissions.").ConfigureAwait(false);
} }
} }
@ -119,11 +119,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await user.RemoveRolesAsync(user.Roles).ConfigureAwait(false); await user.RemoveRolesAsync(user.Roles).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully removed **all** roles from user **{user.Username}**").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully removed **all** roles from user **{user.Username}**").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Failed to remove roles. Most likely reason: Insufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Failed to remove roles. Most likely reason: Insufficient permissions.").ConfigureAwait(false);
} }
} }
@ -140,11 +140,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
var r = await channel.Guild.CreateRoleAsync(roleName).ConfigureAwait(false); var r = await channel.Guild.CreateRoleAsync(roleName).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully created role **{r.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully created role **{r.Name}**.").ConfigureAwait(false);
} }
catch (Exception) catch (Exception)
{ {
await imsg.Channel.SendMessageAsync(":warning: Unspecified error.").ConfigureAwait(false); await channel.SendMessageAsync(":warning: Unspecified error.").ConfigureAwait(false);
} }
} }
@ -157,7 +157,7 @@ namespace NadekoBot.Modules.Administration
if (args.Count() != 2 && args.Count() != 4) if (args.Count() != 2 && args.Count() != 4)
{ {
await imsg.Channel.SendMessageAsync("The parameters are invalid.").ConfigureAwait(false); await channel.SendMessageAsync("The parameters are invalid.").ConfigureAwait(false);
return; return;
} }
var roleName = args[0].ToUpperInvariant(); var roleName = args[0].ToUpperInvariant();
@ -165,7 +165,7 @@ namespace NadekoBot.Modules.Administration
if (role == null) if (role == null)
{ {
await imsg.Channel.SendMessageAsync("That role does not exist.").ConfigureAwait(false); await channel.SendMessageAsync("That role does not exist.").ConfigureAwait(false);
return; return;
} }
try try
@ -178,11 +178,11 @@ namespace NadekoBot.Modules.Administration
var blue = Convert.ToByte(rgb ? int.Parse(args[3]) : Convert.ToInt32(arg1.Substring(4, 2), 16)); var blue = Convert.ToByte(rgb ? int.Parse(args[3]) : Convert.ToInt32(arg1.Substring(4, 2), 16));
await role.ModifyAsync(r => r.Color = new Color(red, green, blue).RawValue).ConfigureAwait(false); await role.ModifyAsync(r => r.Color = new Color(red, green, blue).RawValue).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Role {role.Name}'s color has been changed.").ConfigureAwait(false); await channel.SendMessageAsync($"Role {role.Name}'s color has been changed.").ConfigureAwait(false);
} }
catch (Exception) catch (Exception)
{ {
await imsg.Channel.SendMessageAsync("Error occured, most likely invalid parameters or insufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Error occured, most likely invalid parameters or insufficient permissions.").ConfigureAwait(false);
} }
} }
@ -205,11 +205,11 @@ namespace NadekoBot.Modules.Administration
{ {
await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false); await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("Banned user " + user.Username + " Id: " + user.Id).ConfigureAwait(false); await channel.SendMessageAsync("Banned user " + user.Username + " Id: " + user.Id).ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false);
} }
} }
@ -231,11 +231,11 @@ namespace NadekoBot.Modules.Administration
await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false); await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false);
await channel.Guild.RemoveBanAsync(user).ConfigureAwait(false); await channel.Guild.RemoveBanAsync(user).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("Soft-Banned user " + user.Username + " Id: " + user.Id).ConfigureAwait(false); await channel.SendMessageAsync("Soft-Banned user " + user.Username + " Id: " + user.Id).ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false);
} }
} }
@ -247,7 +247,7 @@ namespace NadekoBot.Modules.Administration
if (user == null) if (user == null)
{ {
await imsg.Channel.SendMessageAsync("User not found.").ConfigureAwait(false); await channel.SendMessageAsync("User not found.").ConfigureAwait(false);
return; return;
} }
if (!string.IsNullOrWhiteSpace(msg)) if (!string.IsNullOrWhiteSpace(msg))
@ -259,11 +259,11 @@ namespace NadekoBot.Modules.Administration
try try
{ {
await user.KickAsync().ConfigureAwait(false); await user.KickAsync().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("Kicked user " + user.Username + " Id: " + user.Id).ConfigureAwait(false); await channel.SendMessageAsync("Kicked user " + user.Username + " Id: " + user.Id).ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); await channel.SendMessageAsync("Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false);
} }
} }
@ -282,11 +282,11 @@ namespace NadekoBot.Modules.Administration
{ {
await u.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false); await u.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync("Mute successful").ConfigureAwait(false); await channel.SendMessageAsync("Mute successful").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false); await channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false);
} }
} }
@ -305,11 +305,11 @@ namespace NadekoBot.Modules.Administration
{ {
await u.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false); await u.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync("Unmute successful").ConfigureAwait(false); await channel.SendMessageAsync("Unmute successful").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false); await channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false);
} }
} }
@ -328,11 +328,11 @@ namespace NadekoBot.Modules.Administration
{ {
await u.ModifyAsync(usr=>usr.Deaf = true).ConfigureAwait(false); await u.ModifyAsync(usr=>usr.Deaf = true).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync("Deafen successful").ConfigureAwait(false); await channel.SendMessageAsync("Deafen successful").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false); await channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false);
} }
} }
@ -351,11 +351,11 @@ namespace NadekoBot.Modules.Administration
{ {
await u.ModifyAsync(usr=> usr.Deaf = false).ConfigureAwait(false); await u.ModifyAsync(usr=> usr.Deaf = false).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync("Undeafen successful").ConfigureAwait(false); await channel.SendMessageAsync("Undeafen successful").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false); await channel.SendMessageAsync("I most likely don't have the permission necessary for that.").ConfigureAwait(false);
} }
} }
@ -365,7 +365,7 @@ namespace NadekoBot.Modules.Administration
public async Task DelVoiChanl(IMessage imsg, [Remainder] IVoiceChannel channel) public async Task DelVoiChanl(IMessage imsg, [Remainder] IVoiceChannel channel)
{ {
await channel.DeleteAsync().ConfigureAwait(false); await channel.DeleteAsync().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Removed channel **{channel.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Removed channel **{channel.Name}**.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -376,7 +376,7 @@ namespace NadekoBot.Modules.Administration
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
//todo actually print info about created channel //todo actually print info about created channel
await channel.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false); await channel.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Created voice channel **{channelName}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Created voice channel **{channelName}**.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -385,7 +385,7 @@ namespace NadekoBot.Modules.Administration
public async Task DelTxtChanl(IMessage imsg, [Remainder] ITextChannel channel) public async Task DelTxtChanl(IMessage imsg, [Remainder] ITextChannel channel)
{ {
await channel.DeleteAsync().ConfigureAwait(false); await channel.DeleteAsync().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Removed text channel **{channel.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Removed text channel **{channel.Name}**.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -396,7 +396,7 @@ namespace NadekoBot.Modules.Administration
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
//todo actually print info about created channel //todo actually print info about created channel
var txtCh = await channel.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false); var txtCh = await channel.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Added text channel **{channelName}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Added text channel **{channelName}**.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -408,7 +408,7 @@ namespace NadekoBot.Modules.Administration
topic = topic ?? ""; topic = topic ?? "";
await (channel as ITextChannel).ModifyAsync(c => c.Topic = topic); await (channel as ITextChannel).ModifyAsync(c => c.Topic = topic);
//await (channel).ModifyAsync(c => c).ConfigureAwait(false); //await (channel).ModifyAsync(c => c).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(":ok: **New channel topic set.**").ConfigureAwait(false); await channel.SendMessageAsync(":ok: **New channel topic set.**").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -419,7 +419,7 @@ namespace NadekoBot.Modules.Administration
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false); await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(":ok: **New channel name set.**").ConfigureAwait(false); await channel.SendMessageAsync(":ok: **New channel name set.**").ConfigureAwait(false);
} }
@ -471,7 +471,7 @@ namespace NadekoBot.Modules.Administration
//{ //{
// var channel = imsg.Channel as ITextChannel; // var channel = imsg.Channel as ITextChannel;
// await imsg.Channel.SendMessageAsync("`Shutting down.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Shutting down.`").ConfigureAwait(false);
// await Task.Delay(2000).ConfigureAwait(false); // await Task.Delay(2000).ConfigureAwait(false);
// Environment.Exit(0); // Environment.Exit(0);
//} //}
@ -501,7 +501,7 @@ namespace NadekoBot.Modules.Administration
// await client.CurrentUser.Edit("", avatar: image.ToStream()).ConfigureAwait(false); // await client.CurrentUser.Edit("", avatar: image.ToStream()).ConfigureAwait(false);
// // Send confirm. // // Send confirm.
// await imsg.Channel.SendMessageAsync("New avatar set.").ConfigureAwait(false); // await channel.SendMessageAsync("New avatar set.").ConfigureAwait(false);
//} //}
////todo owner only ////todo owner only
@ -557,7 +557,7 @@ namespace NadekoBot.Modules.Administration
// } // }
// else // else
// { // {
// await imsg.Channel.SendMessageAsync("`Invalid format.`"); // await channel.SendMessageAsync("`Invalid format.`");
// } // }
//} //}
@ -579,7 +579,7 @@ namespace NadekoBot.Modules.Administration
// UserName = donator.Name, // UserName = donator.Name,
// UserId = (long)donator.Id // UserId = (long)donator.Id
// }); // });
// imsg.Channel.SendMessageAsync("Successfuly added a new donator. 👑").ConfigureAwait(false); // channel.SendMessageAsync("Successfuly added a new donator. 👑").ConfigureAwait(false);
// } // }
// catch { } // catch { }
@ -594,10 +594,10 @@ namespace NadekoBot.Modules.Administration
// foreach (var ch in (await _client.GetGuildsAsync().ConfigureAwait(false)).Select(async g => await g.GetDefaultChannelAsync().ConfigureAwait(false))) // foreach (var ch in (await _client.GetGuildsAsync().ConfigureAwait(false)).Select(async g => await g.GetDefaultChannelAsync().ConfigureAwait(false)))
// { // {
// await imsg.Channel.SendMessageAsync(message).ConfigureAwait(false); // await channel.SendMessageAsync(message).ConfigureAwait(false);
// } // }
// await imsg.Channel.SendMessageAsync(":ok:").ConfigureAwait(false); // await channel.SendMessageAsync(":ok:").ConfigureAwait(false);
//} //}
////todo owner only ////todo owner only
@ -669,7 +669,7 @@ namespace NadekoBot.Modules.Administration
// var donatorsOrdered = rows.OrderByDescending(d => d.Amount); // var donatorsOrdered = rows.OrderByDescending(d => d.Amount);
// string str = $"**Thanks to the people listed below for making this project happen!**\n"; // string str = $"**Thanks to the people listed below for making this project happen!**\n";
// await imsg.Channel.SendMessageAsync(str + string.Join("⭐", donatorsOrdered.Select(d => d.UserName))).ConfigureAwait(false); // await channel.SendMessageAsync(str + string.Join("⭐", donatorsOrdered.Select(d => d.UserName))).ConfigureAwait(false);
//} //}
} }
} }

View File

@ -41,12 +41,12 @@ namespace NadekoBot.Modules.Administration.Commands
// { // {
// config.AutoAssignedRole = 0; // config.AutoAssignedRole = 0;
// await imsg.Channel.SendMessageAsync("`Auto assign role on user join is now disabled.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Auto assign role on user join is now disabled.`").ConfigureAwait(false);
// return; // return;
// } // }
// config.AutoAssignedRole = role.Id; // config.AutoAssignedRole = role.Id;
// await imsg.Channel.SendMessageAsync("`Auto assigned role is set.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Auto assigned role is set.`").ConfigureAwait(false);
//} //}
} }
} }

View File

@ -92,7 +92,7 @@
// if (!Subscribers.TryGetValue(token, out set)) // if (!Subscribers.TryGetValue(token, out set))
// return; // return;
// set.Add(e.Channel); // set.Add(e.Channel);
// await imsg.Channel.SendMessageAsync(":ok:").ConfigureAwait(false); // await channel.SendMessageAsync(":ok:").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "lcsc") // cgb.CreateCommand(Module.Prefix + "lcsc")
@ -104,7 +104,7 @@
// { // {
// subscriber.Value.Remove(e.Channel); // subscriber.Value.Remove(e.Channel);
// } // }
// await imsg.Channel.SendMessageAsync(":ok:").ConfigureAwait(false); // await channel.SendMessageAsync(":ok:").ConfigureAwait(false);
// }); // });
// } // }
// } // }

View File

@ -44,7 +44,7 @@
// var usr = e.Message.MentionedUsers.FirstOrDefault(u => u != e.User); // var usr = e.Message.MentionedUsers.FirstOrDefault(u => u != e.User);
// if (usr?.Status != UserStatus.Offline) // if (usr?.Status != UserStatus.Offline)
// return; // return;
// await imsg.Channel.SendMessageAsync($"User `{usr.Name}` is offline. PM sent.").ConfigureAwait(false); // await channel.SendMessageAsync($"User `{usr.Name}` is offline. PM sent.").ConfigureAwait(false);
// await usr.SendMessage( // await usr.SendMessage(
// $"User `{e.User.Name}` mentioned you on " + // $"User `{e.User.Name}` mentioned you on " +
// $"`{e.Server.Name}` server while you were offline.\n" + // $"`{e.Server.Name}` server while you were offline.\n" +
@ -385,10 +385,10 @@
// specificConfig.SendPrivateMessageOnMention = // specificConfig.SendPrivateMessageOnMention =
// !specificConfig.SendPrivateMessageOnMention; // !specificConfig.SendPrivateMessageOnMention;
// if (specificConfig.SendPrivateMessageOnMention) // if (specificConfig.SendPrivateMessageOnMention)
// await imsg.Channel.SendMessageAsync(":ok: I will send private messages " + // await channel.SendMessageAsync(":ok: I will send private messages " +
// "to mentioned offline users.").ConfigureAwait(false); // "to mentioned offline users.").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync(":ok: I won't send private messages " + // await channel.SendMessageAsync(":ok: I won't send private messages " +
// "to mentioned offline users anymore.").ConfigureAwait(false); // "to mentioned offline users anymore.").ConfigureAwait(false);
// }); // });
@ -402,7 +402,7 @@
// if (chId == null) // if (chId == null)
// { // {
// SpecificConfigurations.Default.Of(e.Server.Id).LogServerChannel = e.Channel.Id; // SpecificConfigurations.Default.Of(e.Server.Id).LogServerChannel = e.Channel.Id;
// await imsg.Channel.SendMessageAsync($"❗**I WILL BEGIN LOGGING SERVER ACTIVITY IN THIS CHANNEL**❗").ConfigureAwait(false); // await channel.SendMessageAsync($"❗**I WILL BEGIN LOGGING SERVER ACTIVITY IN THIS CHANNEL**❗").ConfigureAwait(false);
// return; // return;
// } // }
// Channel ch; // Channel ch;
@ -410,7 +410,7 @@
// return; // return;
// SpecificConfigurations.Default.Of(e.Server.Id).LogServerChannel = null; // SpecificConfigurations.Default.Of(e.Server.Id).LogServerChannel = null;
// await imsg.Channel.SendMessageAsync($"❗**NO LONGER LOGGING IN {ch.Mention} CHANNEL**❗").ConfigureAwait(false); // await channel.SendMessageAsync($"❗**NO LONGER LOGGING IN {ch.Mention} CHANNEL**❗").ConfigureAwait(false);
// }); // });
@ -423,12 +423,12 @@
// var config = SpecificConfigurations.Default.Of(e.Server.Id); // var config = SpecificConfigurations.Default.Of(e.Server.Id);
// if (config.LogserverIgnoreChannels.Remove(e.Channel.Id)) // if (config.LogserverIgnoreChannels.Remove(e.Channel.Id))
// { // {
// await imsg.Channel.SendMessageAsync($"`{Prefix}logserver will stop ignoring this channel.`"); // await channel.SendMessageAsync($"`{Prefix}logserver will stop ignoring this channel.`");
// } // }
// else // else
// { // {
// config.LogserverIgnoreChannels.Add(e.Channel.Id); // config.LogserverIgnoreChannels.Add(e.Channel.Id);
// await imsg.Channel.SendMessageAsync($"`{Prefix}logserver will ignore this channel.`"); // await channel.SendMessageAsync($"`{Prefix}logserver will ignore this channel.`");
// } // }
// }); // });
@ -441,11 +441,11 @@
// if (chId == null) // if (chId == null)
// { // {
// SpecificConfigurations.Default.Of(e.Server.Id).LogPresenceChannel = e.Channel.Id; // SpecificConfigurations.Default.Of(e.Server.Id).LogPresenceChannel = e.Channel.Id;
// await imsg.Channel.SendMessageAsync($"**User presence notifications enabled.**").ConfigureAwait(false); // await channel.SendMessageAsync($"**User presence notifications enabled.**").ConfigureAwait(false);
// return; // return;
// } // }
// SpecificConfigurations.Default.Of(e.Server.Id).LogPresenceChannel = null; // SpecificConfigurations.Default.Of(e.Server.Id).LogPresenceChannel = null;
// await imsg.Channel.SendMessageAsync($"**User presence notifications disabled.**").ConfigureAwait(false); // await channel.SendMessageAsync($"**User presence notifications disabled.**").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "voicepresence") // cgb.CreateCommand(Module.Prefix + "voicepresence")
@ -462,23 +462,23 @@
// { // {
// config.VoiceChannelLog.TryAdd(voiceChannel.Id, e.Channel.Id); // config.VoiceChannelLog.TryAdd(voiceChannel.Id, e.Channel.Id);
// } // }
// await imsg.Channel.SendMessageAsync("Started logging user presence for **ALL** voice channels!").ConfigureAwait(false); // await channel.SendMessageAsync("Started logging user presence for **ALL** voice channels!").ConfigureAwait(false);
// return; // return;
// } // }
// if (e.User.VoiceChannel == null) // if (e.User.VoiceChannel == null)
// { // {
// await imsg.Channel.SendMessageAsync("💢 You are not in a voice channel right now. If you are, please rejoin it.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 You are not in a voice channel right now. If you are, please rejoin it.").ConfigureAwait(false);
// return; // return;
// } // }
// ulong throwaway; // ulong throwaway;
// if (!config.VoiceChannelLog.TryRemove(e.User.VoiceChannel.Id, out throwaway)) // if (!config.VoiceChannelLog.TryRemove(e.User.VoiceChannel.Id, out throwaway))
// { // {
// config.VoiceChannelLog.TryAdd(e.User.VoiceChannel.Id, e.Channel.Id); // config.VoiceChannelLog.TryAdd(e.User.VoiceChannel.Id, e.Channel.Id);
// await imsg.Channel.SendMessageAsync($"`Logging user updates for` {e.User.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); // await channel.SendMessageAsync($"`Logging user updates for` {e.User.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false);
// } // }
// else // else
// await imsg.Channel.SendMessageAsync($"`Stopped logging user updates for` {e.User.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false); // await channel.SendMessageAsync($"`Stopped logging user updates for` {e.User.VoiceChannel.Mention} `voice channel.`").ConfigureAwait(false);
// }); // });
// } // }
// } // }

View File

@ -65,7 +65,7 @@
// Repeater rep; // Repeater rep;
// if (!repeaters.TryGetValue(e.Server, out rep)) // if (!repeaters.TryGetValue(e.Server, out rep))
// { // {
// await imsg.Channel.SendMessageAsync("`No repeating message found on this server.`"); // await channel.SendMessageAsync("`No repeating message found on this server.`");
// return; // return;
// } // }
@ -91,13 +91,13 @@
// if (!repeaters.TryRemove(e.Server, out rep)) // if (!repeaters.TryRemove(e.Server, out rep))
// return; // return;
// rep.MessageTimer.Stop(); // rep.MessageTimer.Stop();
// await imsg.Channel.SendMessageAsync("Repeating disabled").ConfigureAwait(false); // await channel.SendMessageAsync("Repeating disabled").ConfigureAwait(false);
// return; // return;
// } // }
// int minutes; // int minutes;
// if (!int.TryParse(minutesStr, out minutes) || minutes < 1 || minutes > 1440) // if (!int.TryParse(minutesStr, out minutes) || minutes < 1 || minutes > 1440)
// { // {
// await imsg.Channel.SendMessageAsync("Invalid value").ConfigureAwait(false); // await channel.SendMessageAsync("Invalid value").ConfigureAwait(false);
// return; // return;
// } // }
@ -118,7 +118,7 @@
// repeater.MessageTimer.Stop(); // repeater.MessageTimer.Stop();
// repeater.MessageTimer.Start(); // repeater.MessageTimer.Start();
// await imsg.Channel.SendMessageAsync(String.Format("👌 Repeating `{0}` every " + // await channel.SendMessageAsync(String.Format("👌 Repeating `{0}` every " +
// "**{1}** minutes on {2} channel.", // "**{1}** minutes on {2} channel.",
// repeater.RepeatingMessage, minutes, repeater.RepeatingChannel)) // repeater.RepeatingMessage, minutes, repeater.RepeatingChannel))
// .ConfigureAwait(false); // .ConfigureAwait(false);

View File

@ -90,7 +90,7 @@
// finally { // finally {
// playingPlaceholderLock.Release(); // playingPlaceholderLock.Release();
// } // }
// await imsg.Channel.SendMessageAsync($"❗`Rotating playing status has been {(timer.Enabled ? "enabled" : "disabled")}.`").ConfigureAwait(false); // await channel.SendMessageAsync($"❗`Rotating playing status has been {(timer.Enabled ? "enabled" : "disabled")}.`").ConfigureAwait(false);
// }; // };
// internal override void Init(CommandGroupBuilder cgb) // internal override void Init(CommandGroupBuilder cgb)
@ -122,7 +122,7 @@
// { // {
// playingPlaceholderLock.Release(); // playingPlaceholderLock.Release();
// } // }
// await imsg.Channel.SendMessageAsync("🆗 `Added a new playing string.`").ConfigureAwait(false); // await channel.SendMessageAsync("🆗 `Added a new playing string.`").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "listplaying") // cgb.CreateCommand(Module.Prefix + "listplaying")
@ -132,14 +132,14 @@
// .Do(async e => // .Do(async e =>
// { // {
// if (NadekoBot.Config.RotatingStatuses.Count == 0) // if (NadekoBot.Config.RotatingStatuses.Count == 0)
// await imsg.Channel.SendMessageAsync("`There are no playing strings. " + // await channel.SendMessageAsync("`There are no playing strings. " +
// "Add some with .addplaying [text] command.`").ConfigureAwait(false); // "Add some with .addplaying [text] command.`").ConfigureAwait(false);
// var sb = new StringBuilder(); // var sb = new StringBuilder();
// for (var i = 0; i < NadekoBot.Config.RotatingStatuses.Count; i++) // for (var i = 0; i < NadekoBot.Config.RotatingStatuses.Count; i++)
// { // {
// sb.AppendLine($"`{i + 1}.` {NadekoBot.Config.RotatingStatuses[i]}"); // sb.AppendLine($"`{i + 1}.` {NadekoBot.Config.RotatingStatuses[i]}");
// } // }
// await imsg.Channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "removeplaying") // cgb.CreateCommand(Module.Prefix + "removeplaying")
@ -161,7 +161,7 @@
// await ConfigHandler.SaveConfig().ConfigureAwait(false); // await ConfigHandler.SaveConfig().ConfigureAwait(false);
// } // }
// finally { playingPlaceholderLock.Release(); } // finally { playingPlaceholderLock.Release(); }
// await imsg.Channel.SendMessageAsync($"🆗 `Removed playing string #{num}`({str})").ConfigureAwait(false); // await channel.SendMessageAsync($"🆗 `Removed playing string #{num}`({str})").ConfigureAwait(false);
// }); // });
// } // }
// } // }

View File

@ -60,12 +60,12 @@ namespace NadekoBot.Modules.Administration.Commands
ConcurrentDictionary<ulong, DateTime> throwaway; ConcurrentDictionary<ulong, DateTime> throwaway;
if (RatelimitingChannels.TryRemove(channel.Id, out throwaway)) if (RatelimitingChannels.TryRemove(channel.Id, out throwaway))
{ {
await imsg.Channel.SendMessageAsync("Slow mode disabled.").ConfigureAwait(false); await channel.SendMessageAsync("Slow mode disabled.").ConfigureAwait(false);
return; return;
} }
if (RatelimitingChannels.TryAdd(channel.Id, new ConcurrentDictionary<ulong, DateTime>())) if (RatelimitingChannels.TryAdd(channel.Id, new ConcurrentDictionary<ulong, DateTime>()))
{ {
await imsg.Channel.SendMessageAsync("Slow mode initiated. " + await channel.SendMessageAsync("Slow mode initiated. " +
"Users can't send more than 1 message every 5 seconds.") "Users can't send more than 1 message every 5 seconds.")
.ConfigureAwait(false); .ConfigureAwait(false);
} }

View File

@ -40,7 +40,7 @@
// msg.AppendLine($":ok:Role **{role.Name}** added to the list."); // msg.AppendLine($":ok:Role **{role.Name}** added to the list.");
// } // }
// } // }
// await imsg.Channel.SendMessageAsync(msg.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(msg.ToString()).ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "rsar") // cgb.CreateCommand(Module.Prefix + "rsar")
@ -55,17 +55,17 @@
// var role = e.Server.FindRoles(roleName).FirstOrDefault(); // var role = e.Server.FindRoles(roleName).FirstOrDefault();
// if (role == null) // if (role == null)
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false);
// return; // return;
// } // }
// var config = SpecificConfigurations.Default.Of(e.Server.Id); // var config = SpecificConfigurations.Default.Of(e.Server.Id);
// if (!config.ListOfSelfAssignableRoles.Contains(role.Id)) // if (!config.ListOfSelfAssignableRoles.Contains(role.Id))
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false);
// return; // return;
// } // }
// config.ListOfSelfAssignableRoles.Remove(role.Id); // config.ListOfSelfAssignableRoles.Remove(role.Id);
// await imsg.Channel.SendMessageAsync($":ok:**{role.Name}** has been removed from the list of self-assignable roles").ConfigureAwait(false); // await channel.SendMessageAsync($":ok:**{role.Name}** has been removed from the list of self-assignable roles").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "lsar") // cgb.CreateCommand(Module.Prefix + "lsar")
@ -93,7 +93,7 @@
// { // {
// config.ListOfSelfAssignableRoles.Remove(id); // config.ListOfSelfAssignableRoles.Remove(id);
// } // }
// await imsg.Channel.SendMessageAsync(msg.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(msg.ToString()).ConfigureAwait(false);
// }); // });
@ -106,7 +106,7 @@
// var config = SpecificConfigurations.Default.Of(e.Server.Id); // var config = SpecificConfigurations.Default.Of(e.Server.Id);
// config.ExclusiveSelfAssignedRoles = !config.ExclusiveSelfAssignedRoles; // config.ExclusiveSelfAssignedRoles = !config.ExclusiveSelfAssignedRoles;
// string exl = config.ExclusiveSelfAssignedRoles ? "exclusive" : "not exclusive"; // string exl = config.ExclusiveSelfAssignedRoles ? "exclusive" : "not exclusive";
// await imsg.Channel.SendMessageAsync("Self assigned roles are now " + exl); // await channel.SendMessageAsync("Self assigned roles are now " + exl);
// }); // });
// cgb.CreateCommand(Module.Prefix + "iam") // cgb.CreateCommand(Module.Prefix + "iam")
@ -122,24 +122,24 @@
// var role = e.Server.FindRoles(roleName).FirstOrDefault(); // var role = e.Server.FindRoles(roleName).FirstOrDefault();
// if (role == null) // if (role == null)
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false);
// return; // return;
// } // }
// var config = SpecificConfigurations.Default.Of(e.Server.Id); // var config = SpecificConfigurations.Default.Of(e.Server.Id);
// if (!config.ListOfSelfAssignableRoles.Contains(role.Id)) // if (!config.ListOfSelfAssignableRoles.Contains(role.Id))
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false);
// return; // return;
// } // }
// if (e.User.HasRole(role)) // if (e.User.HasRole(role))
// { // {
// await imsg.Channel.SendMessageAsync($":anger:You already have {role.Name} role.").ConfigureAwait(false); // await channel.SendMessageAsync($":anger:You already have {role.Name} role.").ConfigureAwait(false);
// return; // return;
// } // }
// var sameRoles = e.User.Roles.Where(r => config.ListOfSelfAssignableRoles.Contains(r.Id)); // var sameRoles = e.User.Roles.Where(r => config.ListOfSelfAssignableRoles.Contains(r.Id));
// if (config.ExclusiveSelfAssignedRoles && sameRoles.Any()) // if (config.ExclusiveSelfAssignedRoles && sameRoles.Any())
// { // {
// await imsg.Channel.SendMessageAsync($":anger:You already have {sameRoles.FirstOrDefault().Name} role.").ConfigureAwait(false); // await channel.SendMessageAsync($":anger:You already have {sameRoles.FirstOrDefault().Name} role.").ConfigureAwait(false);
// return; // return;
// } // }
// try // try
@ -151,10 +151,10 @@
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// await imsg.Channel.SendMessageAsync($":anger:`I am unable to add that role to you. I can't add roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false); // await channel.SendMessageAsync($":anger:`I am unable to add that role to you. I can't add roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false);
// return; // return;
// } // }
// var msg = await imsg.Channel.SendMessageAsync($":ok:You now have {role.Name} role.").ConfigureAwait(false); // var msg = await channel.SendMessageAsync($":ok:You now have {role.Name} role.").ConfigureAwait(false);
// await Task.Delay(3000).ConfigureAwait(false); // await Task.Delay(3000).ConfigureAwait(false);
// await msg.Delete().ConfigureAwait(false); // await msg.Delete().ConfigureAwait(false);
// try // try
@ -178,22 +178,22 @@
// var role = e.Server.FindRoles(roleName).FirstOrDefault(); // var role = e.Server.FindRoles(roleName).FirstOrDefault();
// if (role == null) // if (role == null)
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role does not exist.").ConfigureAwait(false);
// return; // return;
// } // }
// var config = SpecificConfigurations.Default.Of(e.Server.Id); // var config = SpecificConfigurations.Default.Of(e.Server.Id);
// if (!config.ListOfSelfAssignableRoles.Contains(role.Id)) // if (!config.ListOfSelfAssignableRoles.Contains(role.Id))
// { // {
// await imsg.Channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger:That role is not self-assignable.").ConfigureAwait(false);
// return; // return;
// } // }
// if (!e.User.HasRole(role)) // if (!e.User.HasRole(role))
// { // {
// await imsg.Channel.SendMessageAsync($":anger:You don't have {role.Name} role.").ConfigureAwait(false); // await channel.SendMessageAsync($":anger:You don't have {role.Name} role.").ConfigureAwait(false);
// return; // return;
// } // }
// await e.User.RemoveRoles(role).ConfigureAwait(false); // await e.User.RemoveRoles(role).ConfigureAwait(false);
// var msg = await imsg.Channel.SendMessageAsync($":ok:Successfuly removed {role.Name} role from you.").ConfigureAwait(false); // var msg = await channel.SendMessageAsync($":ok:Successfuly removed {role.Name} role from you.").ConfigureAwait(false);
// await Task.Delay(3000).ConfigureAwait(false); // await Task.Delay(3000).ConfigureAwait(false);
// await msg.Delete().ConfigureAwait(false); // await msg.Delete().ConfigureAwait(false);
// try // try

View File

@ -31,7 +31,7 @@
// if (server == null) // if (server == null)
// { // {
// await imsg.Channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false); // await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
// return; // return;
// } // }
// if (server.OwnerId != _client.GetCurrentUser().Id) // if (server.OwnerId != _client.GetCurrentUser().Id)

View File

@ -215,9 +215,9 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (ann.ToggleDelete()) // if (ann.ToggleDelete())
// await imsg.Channel.SendMessageAsync("`Automatic deletion of greet and bye messages has been enabled.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Automatic deletion of greet and bye messages has been enabled.`").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("`Automatic deletion of greet and bye messages has been disabled.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Automatic deletion of greet and bye messages has been disabled.`").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "greet") // cgb.CreateCommand(Module.Prefix + "greet")
@ -228,9 +228,9 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (ann.ToggleGreet(e.Channel.Id)) // if (ann.ToggleGreet(e.Channel.Id))
// await imsg.Channel.SendMessageAsync("Greet announcements enabled on this channel.").ConfigureAwait(false); // await channel.SendMessageAsync("Greet announcements enabled on this channel.").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("Greet announcements disabled.").ConfigureAwait(false); // await channel.SendMessageAsync("Greet announcements disabled.").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "greetmsg") // cgb.CreateCommand(Module.Prefix + "greetmsg")
@ -242,15 +242,15 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (string.IsNullOrWhiteSpace(e.GetArg("msg"))) // if (string.IsNullOrWhiteSpace(e.GetArg("msg")))
// { // {
// await imsg.Channel.SendMessageAsync("`Current greet message:` " + ann.GreetText); // await channel.SendMessageAsync("`Current greet message:` " + ann.GreetText);
// return; // return;
// } // }
// ann.GreetText = e.GetArg("msg"); // ann.GreetText = e.GetArg("msg");
// await imsg.Channel.SendMessageAsync("New greet message set.").ConfigureAwait(false); // await channel.SendMessageAsync("New greet message set.").ConfigureAwait(false);
// if (!ann.Greet) // if (!ann.Greet)
// await imsg.Channel.SendMessageAsync("Enable greet messsages by typing `.greet`").ConfigureAwait(false); // await channel.SendMessageAsync("Enable greet messsages by typing `.greet`").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "bye") // cgb.CreateCommand(Module.Prefix + "bye")
@ -261,9 +261,9 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (ann.ToggleBye(e.Channel.Id)) // if (ann.ToggleBye(e.Channel.Id))
// await imsg.Channel.SendMessageAsync("Bye announcements enabled on this channel.").ConfigureAwait(false); // await channel.SendMessageAsync("Bye announcements enabled on this channel.").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("Bye announcements disabled.").ConfigureAwait(false); // await channel.SendMessageAsync("Bye announcements disabled.").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "byemsg") // cgb.CreateCommand(Module.Prefix + "byemsg")
@ -275,14 +275,14 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (string.IsNullOrWhiteSpace(e.GetArg("msg"))) // if (string.IsNullOrWhiteSpace(e.GetArg("msg")))
// { // {
// await imsg.Channel.SendMessageAsync("`Current bye message:` " + ann.ByeText); // await channel.SendMessageAsync("`Current bye message:` " + ann.ByeText);
// return; // return;
// } // }
// ann.ByeText = e.GetArg("msg"); // ann.ByeText = e.GetArg("msg");
// await imsg.Channel.SendMessageAsync("New bye message set.").ConfigureAwait(false); // await channel.SendMessageAsync("New bye message set.").ConfigureAwait(false);
// if (!ann.Bye) // if (!ann.Bye)
// await imsg.Channel.SendMessageAsync("Enable bye messsages by typing `.bye`.").ConfigureAwait(false); // await channel.SendMessageAsync("Enable bye messsages by typing `.bye`.").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "byepm") // cgb.CreateCommand(Module.Prefix + "byepm")
@ -294,11 +294,11 @@
// if (ann.ToggleByePM()) // if (ann.ToggleByePM())
// await imsg.Channel.SendMessageAsync("Bye messages will be sent in a PM from now on.\n ⚠ Keep in mind this might fail if the user and the bot have no common servers after the user leaves.").ConfigureAwait(false); // await channel.SendMessageAsync("Bye messages will be sent in a PM from now on.\n ⚠ Keep in mind this might fail if the user and the bot have no common servers after the user leaves.").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("Bye messages will be sent in a bound channel from now on.").ConfigureAwait(false); // await channel.SendMessageAsync("Bye messages will be sent in a bound channel from now on.").ConfigureAwait(false);
// if (!ann.Bye) // if (!ann.Bye)
// await imsg.Channel.SendMessageAsync("Enable bye messsages by typing `.bye`, and set the bye message using `.byemsg`").ConfigureAwait(false); // await channel.SendMessageAsync("Enable bye messsages by typing `.bye`, and set the bye message using `.byemsg`").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "greetpm") // cgb.CreateCommand(Module.Prefix + "greetpm")
@ -310,11 +310,11 @@
// var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); // var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
// if (ann.ToggleGreetPM()) // if (ann.ToggleGreetPM())
// await imsg.Channel.SendMessageAsync("Greet messages will be sent in a PM from now on.").ConfigureAwait(false); // await channel.SendMessageAsync("Greet messages will be sent in a PM from now on.").ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("Greet messages will be sent in a bound channel from now on.").ConfigureAwait(false); // await channel.SendMessageAsync("Greet messages will be sent in a bound channel from now on.").ConfigureAwait(false);
// if (!ann.Greet) // if (!ann.Greet)
// await imsg.Channel.SendMessageAsync("Enable greet messsages by typing `.greet`, and set the greet message using `.greetmsg`").ConfigureAwait(false); // await channel.SendMessageAsync("Enable greet messsages by typing `.greet`, and set the greet message using `.greetmsg`").ConfigureAwait(false);
// }); // });
// } // }
// } // }

View File

@ -97,7 +97,7 @@
// { // {
// if (!e.Server.CurrentUser.ServerPermissions.ManageChannels) // if (!e.Server.CurrentUser.ServerPermissions.ManageChannels)
// { // {
// await imsg.Channel.SendMessageAsync("`I have insufficient permission to do that.`"); // await channel.SendMessageAsync("`I have insufficient permission to do that.`");
// return; // return;
// } // }
@ -116,7 +116,7 @@
// await Task.Delay(500); // await Task.Delay(500);
// } // }
// await imsg.Channel.SendMessageAsync("`Done.`"); // await channel.SendMessageAsync("`Done.`");
// }); // });
// cgb.CreateCommand(Module.Prefix + "voice+text") // cgb.CreateCommand(Module.Prefix + "voice+text")
@ -141,24 +141,24 @@
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync( // await channel.SendMessageAsync(
// ":anger: Error: Most likely i don't have permissions to do this.") // ":anger: Error: Most likely i don't have permissions to do this.")
// .ConfigureAwait(false); // .ConfigureAwait(false);
// return; // return;
// } // }
// } // }
// await imsg.Channel.SendMessageAsync("Successfuly removed voice + text feature.").ConfigureAwait(false); // await channel.SendMessageAsync("Successfuly removed voice + text feature.").ConfigureAwait(false);
// return; // return;
// } // }
// config.VoicePlusTextEnabled = true; // config.VoicePlusTextEnabled = true;
// await imsg.Channel.SendMessageAsync("Successfuly enabled voice + text feature. " + // await channel.SendMessageAsync("Successfuly enabled voice + text feature. " +
// "**Make sure the bot has manage roles and manage channels permissions**") // "**Make sure the bot has manage roles and manage channels permissions**")
// .ConfigureAwait(false); // .ConfigureAwait(false);
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// await imsg.Channel.SendMessageAsync(ex.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(ex.ToString()).ConfigureAwait(false);
// } // }
// }); // });
// } // }

View File

@ -49,7 +49,7 @@ namespace NadekoBot.Modules.ClashOfClans
if (size < 10 || size > 50 || size % 5 != 0) if (size < 10 || size > 50 || size % 5 != 0)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 Not a Valid war size").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 Not a Valid war size").ConfigureAwait(false);
return; return;
} }
List<ClashWar> wars; List<ClashWar> wars;
@ -65,7 +65,7 @@ namespace NadekoBot.Modules.ClashOfClans
//cw.Start(); //cw.Start();
wars.Add(cw); wars.Add(cw);
await imsg.Channel.SendMessageAsync($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false); await channel.SendMessageAsync($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -80,18 +80,18 @@ namespace NadekoBot.Modules.ClashOfClans
var warsInfo = GetWarInfo(imsg, num); var warsInfo = GetWarInfo(imsg, num);
if (warsInfo == null) if (warsInfo == null)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false);
return; return;
} }
var war = warsInfo.Item1[warsInfo.Item2]; var war = warsInfo.Item1[warsInfo.Item2];
try try
{ {
war.Start(); war.Start();
await imsg.Channel.SendMessageAsync($"🔰**STARTED WAR AGAINST {war.ShortPrint()}**").ConfigureAwait(false); await channel.SendMessageAsync($"🔰**STARTED WAR AGAINST {war.ShortPrint()}**").ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync($"🔰**WAR AGAINST {war.ShortPrint()} HAS ALREADY STARTED**").ConfigureAwait(false); await channel.SendMessageAsync($"🔰**WAR AGAINST {war.ShortPrint()} HAS ALREADY STARTED**").ConfigureAwait(false);
} }
} }
@ -109,7 +109,7 @@ namespace NadekoBot.Modules.ClashOfClans
ClashWars.TryGetValue(channel.Guild.Id, out wars); ClashWars.TryGetValue(channel.Guild.Id, out wars);
if (wars == null || wars.Count == 0) if (wars == null || wars.Count == 0)
{ {
await imsg.Channel.SendMessageAsync("🔰 **No active wars.**").ConfigureAwait(false); await channel.SendMessageAsync("🔰 **No active wars.**").ConfigureAwait(false);
return; return;
} }
@ -122,7 +122,7 @@ namespace NadekoBot.Modules.ClashOfClans
sb.AppendLine($"\t\t`Size:` **{wars[i].Size} v {wars[i].Size}**"); sb.AppendLine($"\t\t`Size:` **{wars[i].Size} v {wars[i].Size}**");
sb.AppendLine("**-------------------------**"); sb.AppendLine("**-------------------------**");
} }
await imsg.Channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
return; return;
} }
@ -132,10 +132,10 @@ namespace NadekoBot.Modules.ClashOfClans
var warsInfo = GetWarInfo(imsg, num); var warsInfo = GetWarInfo(imsg, num);
if (warsInfo == null) if (warsInfo == null)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.SendMessageAsync(warsInfo.Item1[warsInfo.Item2].ToString()).ConfigureAwait(false); await channel.SendMessageAsync(warsInfo.Item1[warsInfo.Item2].ToString()).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -146,7 +146,7 @@ namespace NadekoBot.Modules.ClashOfClans
var warsInfo = GetWarInfo(imsg, number); var warsInfo = GetWarInfo(imsg, number);
if (warsInfo == null || warsInfo.Item1.Count == 0) if (warsInfo == null || warsInfo.Item1.Count == 0)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false);
return; return;
} }
var usr = var usr =
@ -157,11 +157,11 @@ namespace NadekoBot.Modules.ClashOfClans
{ {
var war = warsInfo.Item1[warsInfo.Item2]; var war = warsInfo.Item1[warsInfo.Item2];
war.Call(usr, baseNumber - 1); war.Call(usr, baseNumber - 1);
await imsg.Channel.SendMessageAsync($"🔰**{usr}** claimed a base #{baseNumber} for a war against {war.ShortPrint()}").ConfigureAwait(false); await channel.SendMessageAsync($"🔰**{usr}** claimed a base #{baseNumber} for a war against {war.ShortPrint()}").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false);
} }
} }
@ -198,11 +198,11 @@ namespace NadekoBot.Modules.ClashOfClans
var warsInfo = GetWarInfo(imsg,number); var warsInfo = GetWarInfo(imsg,number);
if (warsInfo == null) if (warsInfo == null)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 That war does not exist.").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 That war does not exist.").ConfigureAwait(false);
return; return;
} }
warsInfo.Item1[warsInfo.Item2].End(); warsInfo.Item1[warsInfo.Item2].End();
await imsg.Channel.SendMessageAsync($"❗🔰**War against {warsInfo.Item1[warsInfo.Item2].ShortPrint()} ended.**").ConfigureAwait(false); await channel.SendMessageAsync($"❗🔰**War against {warsInfo.Item1[warsInfo.Item2].ShortPrint()} ended.**").ConfigureAwait(false);
var size = warsInfo.Item1[warsInfo.Item2].Size; var size = warsInfo.Item1[warsInfo.Item2].Size;
warsInfo.Item1.RemoveAt(warsInfo.Item2); warsInfo.Item1.RemoveAt(warsInfo.Item2);
@ -217,7 +217,7 @@ namespace NadekoBot.Modules.ClashOfClans
var warsInfo = GetWarInfo(imsg, number); var warsInfo = GetWarInfo(imsg, number);
if (warsInfo == null || warsInfo.Item1.Count == 0) if (warsInfo == null || warsInfo.Item1.Count == 0)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false);
return; return;
} }
var usr = var usr =
@ -228,11 +228,11 @@ namespace NadekoBot.Modules.ClashOfClans
{ {
var war = warsInfo.Item1[warsInfo.Item2]; var war = warsInfo.Item1[warsInfo.Item2];
var baseNumber = war.Uncall(usr); var baseNumber = war.Uncall(usr);
await imsg.Channel.SendMessageAsync($"🔰 @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}").ConfigureAwait(false); await channel.SendMessageAsync($"🔰 @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false);
} }
} }
@ -242,7 +242,7 @@ namespace NadekoBot.Modules.ClashOfClans
var warInfo = GetWarInfo(imsg, number); var warInfo = GetWarInfo(imsg, number);
if (warInfo == null || warInfo.Item1.Count == 0) if (warInfo == null || warInfo.Item1.Count == 0)
{ {
await imsg.Channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false); await channel.SendMessageAsync("💢🔰 **That war does not exist.**").ConfigureAwait(false);
return; return;
} }
var usr = var usr =
@ -254,11 +254,11 @@ namespace NadekoBot.Modules.ClashOfClans
try try
{ {
var baseNum = war.FinishClaim(usr, stars); var baseNum = war.FinishClaim(usr, stars);
await imsg.Channel.SendMessageAsync($"❗🔰{imsg.Author.Mention} **DESTROYED** a base #{baseNum + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); await channel.SendMessageAsync($"❗🔰{imsg.Author.Mention} **DESTROYED** a base #{baseNum + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢🔰 {ex.Message}").ConfigureAwait(false);
} }
} }

View File

@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Gambling
arr[i] = r.Next(1, n2 + 1); arr[i] = r.Next(1, n2 + 1);
} }
var elemCnt = 0; var elemCnt = 0;
await imsg.Channel.SendMessageAsync($"`Rolled {n1} {(n1 == 1 ? "die" : "dice")} 1-{n2}.`\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false); await channel.SendMessageAsync($"`Rolled {n1} {(n1 == 1 ? "die" : "dice")} 1-{n2}.`\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false);
} }
return; return;
} }
@ -88,7 +88,7 @@ namespace NadekoBot.Modules.Gambling
if (num < 1) num = 1; if (num < 1) num = 1;
if (num > 30) if (num > 30)
{ {
await imsg.Channel.SendMessageAsync("You can roll up to 30 dice at a time.").ConfigureAwait(false); await channel.SendMessageAsync("You can roll up to 30 dice at a time.").ConfigureAwait(false);
num = 30; num = 30;
} }
var dices = new List<Image>(num); var dices = new List<Image>(num);
@ -119,12 +119,12 @@ namespace NadekoBot.Modules.Gambling
} }
var bitmap = dices.Merge(); var bitmap = dices.Merge();
await imsg.Channel.SendMessageAsync(values.Count + " Dice rolled. Total: **" + values.Sum() + "** Average: **" + (values.Sum() / (1.0f * values.Count)).ToString("N2") + "**").ConfigureAwait(false); await channel.SendMessageAsync(values.Count + " Dice rolled. Total: **" + values.Sum() + "** Average: **" + (values.Sum() / (1.0f * values.Count)).ToString("N2") + "**").ConfigureAwait(false);
await e.Channel.SendFile("dice.png", bitmap.ToStream(ImageFormat.Png)).ConfigureAwait(false); await e.Channel.SendFile("dice.png", bitmap.ToStream(ImageFormat.Png)).ConfigureAwait(false);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Please enter a number of dice to roll.").ConfigureAwait(false); await channel.SendMessageAsync("Please enter a number of dice to roll.").ConfigureAwait(false);
} }
}; };
} }
@ -151,11 +151,11 @@ namespace NadekoBot.Modules.Gambling
rolled = new Random().Next(0, int.Parse(e.GetArg("range")) + 1); rolled = new Random().Next(0, int.Parse(e.GetArg("range")) + 1);
} }
await imsg.Channel.SendMessageAsync($"{e.User.Mention} rolled **{rolled}**.").ConfigureAwait(false); await channel.SendMessageAsync($"{e.User.Mention} rolled **{rolled}**.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($":anger: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($":anger: {ex.Message}").ConfigureAwait(false);
} }
}; };
} }

View File

@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Gambling
return c; return c;
}); });
await imsg.Channel.SendMessageAsync("Deck reshuffled.").ConfigureAwait(false); await channel.SendMessageAsync("Deck reshuffled.").ConfigureAwait(false);
}; };
} }
@ -68,7 +68,7 @@ namespace NadekoBot.Modules.Gambling
{ {
if (cards.CardPool.Count == 0 && i != 0) if (cards.CardPool.Count == 0 && i != 0)
{ {
await imsg.Channel.SendMessageAsync("No more cards in a deck.").ConfigureAwait(false); await channel.SendMessageAsync("No more cards in a deck.").ConfigureAwait(false);
break; break;
} }
var currentCard = cards.DrawACard(); var currentCard = cards.DrawACard();
@ -79,7 +79,7 @@ namespace NadekoBot.Modules.Gambling
await e.Channel.SendFile(images.Count + " cards.jpg", bitmap.ToStream()).ConfigureAwait(false); await e.Channel.SendFile(images.Count + " cards.jpg", bitmap.ToStream()).ConfigureAwait(false);
if (cardObjects.Count == 5) if (cardObjects.Count == 5)
{ {
await imsg.Channel.SendMessageAsync($"{e.User.Mention} `{Cards.GetHandValue(cardObjects)}`").ConfigureAwait(false); await channel.SendMessageAsync($"{e.User.Mention} `{Cards.GetHandValue(cardObjects)}`").ConfigureAwait(false);
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -29,180 +29,180 @@ namespace NadekoBot.Modules.Gambling
var members = (await role.Members()).Where(u => u.Status == UserStatus.Online); var members = (await role.Members()).Where(u => u.Status == UserStatus.Online);
var membersArray = members as IUser[] ?? members.ToArray(); var membersArray = members as IUser[] ?? members.ToArray();
var usr = membersArray[new Random().Next(0, membersArray.Length)]; var usr = membersArray[new Random().Next(0, membersArray.Length)];
await imsg.Channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false); await channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false);
} }
////todo DB
//[LocalizedCommand("$$$"), LocalizedDescription("$$$"), LocalizedSummary("$$$")]
//[RequireContext(ContextType.Guild)]
//public async Task Cash(IMessage imsg, [Remainder] string arg)
//{
// var channel = imsg.Channel as ITextChannel;
// var usr = e.Message.MentionedUsers.FirstOrDefault() ?? e.User;
// var pts = GetUserFlowers(usr.Id);
// var str = $"{usr.Name} has {pts} {NadekoBot.Config.CurrencySign}";
// await channel.SendMessageAsync(str).ConfigureAwait(false);
//}
////todo DB
//[LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)]
//public async Task Give(IMessage imsg, long amount, [Remainder] IUser receiver)
//{
// var channel = imsg.Channel as ITextChannel;
// if (amount <= 0)
// return;
// var userFlowers = GetUserFlowers(imsg.Author.Id);
// if (userFlowers < amount)
// {
// await channel.SendMessageAsync($"{e.User.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false);
// return;
// }
// await FlowersHandler.RemoveFlowers(e.User, "Gift", (int)amount, true).ConfigureAwait(false);
// await FlowersHandler.AddFlowersAsync(receiver, "Gift", (int)amount).ConfigureAwait(false);
// await channel.SendMessageAsync($"{e.User.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {receiver.Mention}!").ConfigureAwait(false);
//}
////todo DB
////todo owner only
//[LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)]
//public Task Award(IMessage imsg, long amount, [Remainder] IGuildUser usr) =>
// Award(imsg, amount, usr.Id);
//[LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)]
//public async Task Award(IMessage imsg, long amount, [Remainder] ulong usrId)
//{
// var channel = imsg.Channel as ITextChannel;
// if (amount <= 0)
// return;
// await FlowersHandler.AddFlowersAsync(usrId, $"Awarded by bot owner. ({imsg.Author.Username}/{imsg.Author.Id})", (int)amount).ConfigureAwait(false);
// await channel.SendMessageAsync($"{e.User.Mention} successfully awarded {amount} {NadekoBot.Config.CurrencyName}s to <@{usrId}>!").ConfigureAwait(false);
//}
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
[RequireContext(ContextType.Guild)]
public async Task Take(IMessage imsg, long amount, [Remainder] IGuildUser ownedPerson)
{
var channel = imsg.Channel as ITextChannel;
if (amount < 0)
return;
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u =>
u.Id != NadekoBot.Client.CurrentUser.Id);
if (mentionedUser == null)
return;
await FlowersHandler.RemoveFlowers(ownedPerson.Id, $"Taken by bot owner.({e.User.Name}/{e.User.Id})", (int)amount).ConfigureAwait(false);
await channel.SendMessageAsync($"{e.User.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from {mentionedUser.Mention}!").ConfigureAwait(false);
}
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
manager.CreateCommands("", cgb => cgb.CreateCommand(Prefix + "award")
{ .Description($"Gives someone a certain amount of flowers. **Bot Owner Only!** | `{Prefix}award 100 @person`")
cgb.CreateCommand(Prefix + "raffle") .AddCheck(SimpleCheckers.OwnerOnly())
.Description($"Prints a name and ID of a random user from the online list from the (optional) role. | `{Prefix}raffle` or `{Prefix}raffle RoleName`") .Parameter("amount", ParameterType.Required)
.Parameter("role", ParameterType.Optional) .Parameter("receiver", ParameterType.Unparsed)
.Do(async e => .Do(async e =>
{
});
cgb.CreateCommand(Prefix + "take")
.Description($"Takes a certain amount of flowers from someone. **Bot Owner Only!** | `{Prefix}take 1 \"@someguy\"`")
.AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required)
.Parameter("rektperson", ParameterType.Unparsed)
.Do(async e =>
{
});
cgb.CreateCommand(Prefix + "betroll")
.Alias(Prefix + "br")
.Description($"Bets a certain amount of {NadekoBot.Config.CurrencyName}s and rolls a dice. Rolling over 66 yields x2 flowers, over 90 - x3 and 100 x10. | `{Prefix}br 5`")
.Parameter("amount", ParameterType.Required)
.Do(async e =>
{
var amountstr = e.GetArg("amount").Trim();
int amount;
if (!int.TryParse(amountstr, out amount) || amount < 1)
return;
var userFlowers = GetUserFlowers(e.User.Id);
if (userFlowers < amount)
{ {
await channel.SendMessageAsync($"{e.User.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false);
}); return;
}
cgb.CreateCommand(Prefix + "$$") await FlowersHandler.RemoveFlowers(e.User, "Betroll Gamble", (int)amount, true).ConfigureAwait(false);
.Description(string.Format("Check how much {0}s a person has. (Defaults to yourself) |`{1}$$` or `{1}$$ @Someone`",
NadekoBot.Config.CurrencyName, Prefix)) var rng = new Random().Next(0, 101);
.Parameter("all", ParameterType.Unparsed) var str = $"{e.User.Mention} `You rolled {rng}.` ";
.Do(async e => if (rng < 67)
{ {
var usr = e.Message.MentionedUsers.FirstOrDefault() ?? e.User; str += "Better luck next time.";
var pts = GetUserFlowers(usr.Id); }
var str = $"{usr.Name} has {pts} {NadekoBot.Config.CurrencySign}"; else if (rng < 90)
await imsg.Channel.SendMessageAsync(str).ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "give")
.Description(string.Format("Give someone a certain amount of {0}s", NadekoBot.Config.CurrencyName)+ $"|`{Prefix}give 1 \"@SomeGuy\"`")
.Parameter("amount", ParameterType.Required)
.Parameter("receiver", ParameterType.Unparsed)
.Do(async e =>
{ {
var amountStr = e.GetArg("amount")?.Trim(); str += $"Congratulations! You won {amount * 2}{NadekoBot.Config.CurrencySign} for rolling above 66";
long amount; await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 2, true).ConfigureAwait(false);
if (!long.TryParse(amountStr, out amount) || amount <= 0) }
return; else if (rng < 100)
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u =>
u.Id != NadekoBot.Client.CurrentUser.Id &&
u.Id != e.User.Id);
if (mentionedUser == null)
return;
var userFlowers = GetUserFlowers(e.User.Id);
if (userFlowers < amount)
{
await imsg.Channel.SendMessageAsync($"{e.User.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false);
return;
}
await FlowersHandler.RemoveFlowers(e.User, "Gift", (int)amount, true).ConfigureAwait(false);
await FlowersHandler.AddFlowersAsync(mentionedUser, "Gift", (int)amount).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"{e.User.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {mentionedUser.Mention}!").ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "award")
.Description($"Gives someone a certain amount of flowers. **Bot Owner Only!** | `{Prefix}award 100 @person`")
.AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required)
.Parameter("receiver", ParameterType.Unparsed)
.Do(async e =>
{ {
var amountStr = e.GetArg("amount")?.Trim(); str += $"Congratulations! You won {amount * 3}{NadekoBot.Config.CurrencySign} for rolling above 90.";
long amount; await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 3, true).ConfigureAwait(false);
if (!long.TryParse(amountStr, out amount) || amount < 0) }
return; else
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u =>
u.Id != NadekoBot.Client.CurrentUser.Id);
if (mentionedUser == null)
return;
await FlowersHandler.AddFlowersAsync(mentionedUser, $"Awarded by bot owner. ({e.User.Name}/{e.User.Id})", (int)amount).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"{e.User.Mention} successfully awarded {amount} {NadekoBot.Config.CurrencyName}s to {mentionedUser.Mention}!").ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "take")
.Description($"Takes a certain amount of flowers from someone. **Bot Owner Only!** | `{Prefix}take 1 \"@someguy\"`")
.AddCheck(SimpleCheckers.OwnerOnly())
.Parameter("amount", ParameterType.Required)
.Parameter("rektperson", ParameterType.Unparsed)
.Do(async e =>
{ {
var amountStr = e.GetArg("amount")?.Trim(); str += $"👑 Congratulations! You won {amount * 10}{NadekoBot.Config.CurrencySign} for rolling **100**. 👑";
long amount; await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 10, true).ConfigureAwait(false);
if (!long.TryParse(amountStr, out amount) || amount < 0) }
return;
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u => await channel.SendMessageAsync(str).ConfigureAwait(false);
u.Id != NadekoBot.Client.CurrentUser.Id);
if (mentionedUser == null)
return;
await FlowersHandler.RemoveFlowers(mentionedUser, $"Taken by bot owner.({e.User.Name}/{e.User.Id})", (int)amount).ConfigureAwait(false); });
await imsg.Channel.SendMessageAsync($"{e.User.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from {mentionedUser.Mention}!").ConfigureAwait(false); cgb.CreateCommand(Prefix + "leaderboard")
}); .Alias(Prefix + "lb")
.Description($"Displays bot currency leaderboard | `{Prefix}lb`")
cgb.CreateCommand(Prefix + "betroll") .Do(async e =>
.Alias(Prefix + "br") {
.Description($"Bets a certain amount of {NadekoBot.Config.CurrencyName}s and rolls a dice. Rolling over 66 yields x2 flowers, over 90 - x3 and 100 x10. | `{Prefix}br 5`") var richestTemp = DbHandler.Instance.GetTopRichest();
.Parameter("amount",ParameterType.Required) var richest = richestTemp as CurrencyState[] ?? richestTemp.ToArray();
.Do(async e => if (richest.Length == 0)
{ return;
var amountstr = e.GetArg("amount").Trim(); await channel.SendMessageAsync(
int amount; richest.Aggregate(new StringBuilder(
$@"```xl
if (!int.TryParse(amountstr, out amount) || amount < 1)
return;
var userFlowers = GetUserFlowers(e.User.Id);
if (userFlowers < amount)
{
await imsg.Channel.SendMessageAsync($"{e.User.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false);
return;
}
await FlowersHandler.RemoveFlowers(e.User, "Betroll Gamble", (int)amount, true).ConfigureAwait(false);
var rng = new Random().Next(0, 101);
var str = $"{e.User.Mention} `You rolled {rng}.` ";
if (rng < 67)
{
str += "Better luck next time.";
}
else if (rng < 90)
{
str += $"Congratulations! You won {amount * 2}{NadekoBot.Config.CurrencySign} for rolling above 66";
await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 2, true).ConfigureAwait(false);
}
else if (rng < 100)
{
str += $"Congratulations! You won {amount * 3}{NadekoBot.Config.CurrencySign} for rolling above 90.";
await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 3, true).ConfigureAwait(false);
}
else {
str += $"👑 Congratulations! You won {amount * 10}{NadekoBot.Config.CurrencySign} for rolling **100**. 👑";
await FlowersHandler.AddFlowersAsync(e.User, "Betroll Gamble", amount * 10, true).ConfigureAwait(false);
}
await imsg.Channel.SendMessageAsync(str).ConfigureAwait(false);
});
cgb.CreateCommand(Prefix + "leaderboard")
.Alias(Prefix + "lb")
.Description($"Displays bot currency leaderboard | `{Prefix}lb`")
.Do(async e =>
{
var richestTemp = DbHandler.Instance.GetTopRichest();
var richest = richestTemp as CurrencyState[] ?? richestTemp.ToArray();
if (richest.Length == 0)
return;
await imsg.Channel.SendMessageAsync(
richest.Aggregate(new StringBuilder(
$@"```xl
Id $$$ Id $$$
"), "),
(cur, cs) => cur.AppendLine( (cur, cs) => cur.AppendLine(
$@"┣━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━┫ $@"┣━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━┫
{(e.Server.Users.Where(u => u.Id == (ulong)cs.UserId).FirstOrDefault()?.Name.TrimTo(18, true) ?? cs.UserId.ToString()),-20} {cs.Value,5} ") {(e.Server.Users.Where(u => u.Id == (ulong)cs.UserId).FirstOrDefault()?.Name.TrimTo(18, true) ?? cs.UserId.ToString()),-20} {cs.Value,5} ")
).ToString() + "┗━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━┛```").ConfigureAwait(false); ).ToString() + "┗━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━┛```").ConfigureAwait(false);
}); });
}); });
} }
public static long GetUserFlowers(ulong userId) => public static long GetUserFlowers(ulong userId) =>
Classes.DbHandler.Instance.GetStateByUserId((long)userId)?.Value ?? 0; Classes.DbHandler.Instance.GetStateByUserId((long)userId)?.Value ?? 0;
} }
} }

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Modules.Games.Commands
text = text.Trim(); text = text.Trim();
if (string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(text))
return; return;
await imsg.Channel.SendMessageAsync(ToLeet(text, level)).ConfigureAwait(false); await channel.SendMessageAsync(ToLeet(text, level)).ConfigureAwait(false);
} }

View File

@ -51,7 +51,7 @@
// var rnd = Math.Abs(rng.Next(0,101)); // var rnd = Math.Abs(rng.Next(0,101));
// if (rnd == 0) // if (rnd == 0)
// { // {
// var msgs = new[] { await e.Channel.SendFile(GetRandomCurrencyImagePath()), await imsg.Channel.SendMessageAsync($"❗ A random {NadekoBot.Config.CurrencyName} appeared! Pick it up by typing `>pick`") }; // var msgs = new[] { await e.Channel.SendFile(GetRandomCurrencyImagePath()), await channel.SendMessageAsync($"❗ A random {NadekoBot.Config.CurrencyName} appeared! Pick it up by typing `>pick`") };
// plantedFlowerChannels.AddOrUpdate(e.Channel.Id, msgs, (u, m) => { m.ForEach(async msgToDelete => { try { await msgToDelete.Delete(); } catch { } }); return msgs; }); // plantedFlowerChannels.AddOrUpdate(e.Channel.Id, msgs, (u, m) => { m.ForEach(async msgToDelete => { try { await msgToDelete.Delete(); } catch { } }); return msgs; });
// plantpickCooldowns.AddOrUpdate(e.Channel.Id, now, (i, d) => now); // plantpickCooldowns.AddOrUpdate(e.Channel.Id, now, (i, d) => now);
// } // }
@ -80,7 +80,7 @@
// await msgToDelete.Delete().ConfigureAwait(false); // await msgToDelete.Delete().ConfigureAwait(false);
// await FlowersHandler.AddFlowersAsync(e.User, "Picked a flower.", 1, true).ConfigureAwait(false); // await FlowersHandler.AddFlowersAsync(e.User, "Picked a flower.", 1, true).ConfigureAwait(false);
// var msg = await imsg.Channel.SendMessageAsync($"**{e.User.Name}** picked a {NadekoBot.Config.CurrencyName}!").ConfigureAwait(false); // var msg = await channel.SendMessageAsync($"**{e.User.Name}** picked a {NadekoBot.Config.CurrencyName}!").ConfigureAwait(false);
// ThreadPool.QueueUserWorkItem(async (state) => // ThreadPool.QueueUserWorkItem(async (state) =>
// { // {
// try // try
@ -101,24 +101,24 @@
// { // {
// if (plantedFlowerChannels.ContainsKey(e.Channel.Id)) // if (plantedFlowerChannels.ContainsKey(e.Channel.Id))
// { // {
// await imsg.Channel.SendMessageAsync($"There is already a {NadekoBot.Config.CurrencyName} in this channel.").ConfigureAwait(false); // await channel.SendMessageAsync($"There is already a {NadekoBot.Config.CurrencyName} in this channel.").ConfigureAwait(false);
// return; // return;
// } // }
// var removed = await FlowersHandler.RemoveFlowers(e.User, "Planted a flower.", 1, true).ConfigureAwait(false); // var removed = await FlowersHandler.RemoveFlowers(e.User, "Planted a flower.", 1, true).ConfigureAwait(false);
// if (!removed) // if (!removed)
// { // {
// await imsg.Channel.SendMessageAsync($"You don't have any {NadekoBot.Config.CurrencyName}s.").ConfigureAwait(false); // await channel.SendMessageAsync($"You don't have any {NadekoBot.Config.CurrencyName}s.").ConfigureAwait(false);
// return; // return;
// } // }
// var file = GetRandomCurrencyImagePath(); // var file = GetRandomCurrencyImagePath();
// Message msg; // Message msg;
// if (file == null) // if (file == null)
// msg = await imsg.Channel.SendMessageAsync(NadekoBot.Config.CurrencySign).ConfigureAwait(false); // msg = await channel.SendMessageAsync(NadekoBot.Config.CurrencySign).ConfigureAwait(false);
// else // else
// msg = await e.Channel.SendFile(file).ConfigureAwait(false); // msg = await e.Channel.SendFile(file).ConfigureAwait(false);
// var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(NadekoBot.Config.CurrencyName[0]); // var vowelFirst = new[] { 'a', 'e', 'i', 'o', 'u' }.Contains(NadekoBot.Config.CurrencyName[0]);
// var msg2 = await imsg.Channel.SendMessageAsync($"Oh how Nice! **{e.User.Name}** planted {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencyName}. Pick it using {Module.Prefix}pick").ConfigureAwait(false); // var msg2 = await channel.SendMessageAsync($"Oh how Nice! **{e.User.Name}** planted {(vowelFirst ? "an" : "a")} {NadekoBot.Config.CurrencyName}. Pick it using {Module.Prefix}pick").ConfigureAwait(false);
// plantedFlowerChannels.TryAdd(e.Channel.Id, new[] { msg, msg2 }); // plantedFlowerChannels.TryAdd(e.Channel.Id, new[] { msg, msg2 });
// } // }
// finally { locker.Release(); } // finally { locker.Release(); }
@ -141,12 +141,12 @@
// int throwaway; // int throwaway;
// if (config.GenerateCurrencyChannels.TryRemove(e.Channel.Id, out throwaway)) // if (config.GenerateCurrencyChannels.TryRemove(e.Channel.Id, out throwaway))
// { // {
// await imsg.Channel.SendMessageAsync("`Currency generation disabled on this channel.`").ConfigureAwait(false); // await channel.SendMessageAsync("`Currency generation disabled on this channel.`").ConfigureAwait(false);
// } // }
// else // else
// { // {
// if (config.GenerateCurrencyChannels.TryAdd(e.Channel.Id, cd)) // if (config.GenerateCurrencyChannels.TryAdd(e.Channel.Id, cd))
// await imsg.Channel.SendMessageAsync($"`Currency generation enabled on this channel. Cooldown is {cd} minutes.`").ConfigureAwait(false); // await channel.SendMessageAsync($"`Currency generation enabled on this channel. Cooldown is {cd} minutes.`").ConfigureAwait(false);
// } // }
// }); // });
// } // }

View File

@ -76,7 +76,7 @@ namespace NadekoBot.Modules.Games.Commands
var num = 1; var num = 1;
msgToSend = answers.Aggregate(msgToSend, (current, answ) => current + $"`{num++}.` **{answ}**\n"); msgToSend = answers.Aggregate(msgToSend, (current, answ) => current + $"`{num++}.` **{answ}**\n");
msgToSend += "\n**Private Message me with the corresponding number of the answer.**"; msgToSend += "\n**Private Message me with the corresponding number of the answer.**";
await imsg.Channel.SendMessageAsync(msgToSend).ConfigureAwait(false); await channel.SendMessageAsync(msgToSend).ConfigureAwait(false);
} }
public async Task StopPoll(IGuildChannel ch) public async Task StopPoll(IGuildChannel ch)
@ -91,7 +91,7 @@ namespace NadekoBot.Modules.Games.Commands
var totalVotesCast = results.Sum(kvp => kvp.Value); var totalVotesCast = results.Sum(kvp => kvp.Value);
if (totalVotesCast == 0) if (totalVotesCast == 0)
{ {
await imsg.Channel.SendMessageAsync("📄 **No votes have been cast.**").ConfigureAwait(false); await channel.SendMessageAsync("📄 **No votes have been cast.**").ConfigureAwait(false);
return; return;
} }
var closeMessage = $"--------------**POLL CLOSED**--------------\n" + var closeMessage = $"--------------**POLL CLOSED**--------------\n" +
@ -100,7 +100,7 @@ namespace NadekoBot.Modules.Games.Commands
$" has {kvp.Value} votes." + $" has {kvp.Value} votes." +
$"({kvp.Value * 1.0f / totalVotesCast * 100}%)\n"); $"({kvp.Value * 1.0f / totalVotesCast * 100}%)\n");
await imsg.Channel.SendMessageAsync($"📄 **Total votes cast**: {totalVotesCast}\n{closeMessage}").ConfigureAwait(false); await channel.SendMessageAsync($"📄 **Total votes cast**: {totalVotesCast}\n{closeMessage}").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -115,7 +115,7 @@
// await channel.Send($"{e.User.Mention} finished in **{sw.Elapsed.Seconds}** seconds with { distance } errors, **{ CurrentSentence.Length / WORD_VALUE / sw.Elapsed.Seconds * 60 }** WPM!").ConfigureAwait(false); // await channel.Send($"{e.User.Mention} finished in **{sw.Elapsed.Seconds}** seconds with { distance } errors, **{ CurrentSentence.Length / WORD_VALUE / sw.Elapsed.Seconds * 60 }** WPM!").ConfigureAwait(false);
// if (finishedUserIds.Count % 2 == 0) // if (finishedUserIds.Count % 2 == 0)
// { // {
// await imsg.Channel.SendMessageAsync($":exclamation: `A lot of people finished, here is the text for those still typing:`\n\n:book:**{CurrentSentence}**:book:").ConfigureAwait(false); // await channel.SendMessageAsync($":exclamation: `A lot of people finished, here is the text for those still typing:`\n\n:book:**{CurrentSentence}**:book:").ConfigureAwait(false);
// } // }
// } // }
// } // }
@ -143,7 +143,7 @@
// if (game.IsActive) // if (game.IsActive)
// { // {
// await imsg.Channel.SendMessageAsync( // await channel.SendMessageAsync(
// $"Contest already running in " + // $"Contest already running in " +
// $"{game.Channell.Mention} channel.") // $"{game.Channell.Mention} channel.")
// .ConfigureAwait(false); // .ConfigureAwait(false);
@ -163,7 +163,7 @@
// await game.Stop().ConfigureAwait(false); // await game.Stop().ConfigureAwait(false);
// return; // return;
// } // }
// await imsg.Channel.SendMessageAsync("No contest to stop on this channel.").ConfigureAwait(false); // await channel.SendMessageAsync("No contest to stop on this channel.").ConfigureAwait(false);
// }; // };
// internal override void Init(CommandGroupBuilder cgb) // internal override void Init(CommandGroupBuilder cgb)
@ -189,7 +189,7 @@
// DateAdded = DateTime.Now // DateAdded = DateTime.Now
// }); // });
// await imsg.Channel.SendMessageAsync("Added new article for typing game.").ConfigureAwait(false); // await channel.SendMessageAsync("Added new article for typing game.").ConfigureAwait(false);
// }); // });
// } // }
// } // }

View File

@ -36,12 +36,12 @@ namespace NadekoBot.Modules.Games.Commands
return; return;
var triviaGame = new TriviaGame(channel.Guild, imsg.Channel as ITextChannel, showHints, number == 0 ? 10 : number); var triviaGame = new TriviaGame(channel.Guild, imsg.Channel as ITextChannel, showHints, number == 0 ? 10 : number);
if (RunningTrivias.TryAdd(channel.Guild.Id, triviaGame)) if (RunningTrivias.TryAdd(channel.Guild.Id, triviaGame))
await imsg.Channel.SendMessageAsync($"**Trivia game started! {triviaGame.WinRequirement} points needed to win.**").ConfigureAwait(false); await channel.SendMessageAsync($"**Trivia game started! {triviaGame.WinRequirement} points needed to win.**").ConfigureAwait(false);
else else
await triviaGame.StopGame().ConfigureAwait(false); await triviaGame.StopGame().ConfigureAwait(false);
} }
else else
await imsg.Channel.SendMessageAsync("Trivia game is already running on this server.\n" + trivia.CurrentQuestion).ConfigureAwait(false); await channel.SendMessageAsync("Trivia game is already running on this server.\n" + trivia.CurrentQuestion).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -52,9 +52,9 @@ namespace NadekoBot.Modules.Games.Commands
TriviaGame trivia; TriviaGame trivia;
if (RunningTrivias.TryGetValue(channel.Guild.Id, out trivia)) if (RunningTrivias.TryGetValue(channel.Guild.Id, out trivia))
await imsg.Channel.SendMessageAsync(trivia.GetLeaderboard()).ConfigureAwait(false); await channel.SendMessageAsync(trivia.GetLeaderboard()).ConfigureAwait(false);
else else
await imsg.Channel.SendMessageAsync("No trivia is running on this server.").ConfigureAwait(false); await channel.SendMessageAsync("No trivia is running on this server.").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Games.Commands
await trivia.StopGame().ConfigureAwait(false); await trivia.StopGame().ConfigureAwait(false);
} }
else else
await imsg.Channel.SendMessageAsync("No trivia is running on this server.").ConfigureAwait(false); await channel.SendMessageAsync("No trivia is running on this server.").ConfigureAwait(false);
} }
} }
} }

View File

@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Games
if (listArr.Count() < 2) if (listArr.Count() < 2)
return; return;
var rng = new Random(); var rng = new Random();
await imsg.Channel.SendMessageAsync(listArr[rng.Next(0, listArr.Length)]).ConfigureAwait(false); await channel.SendMessageAsync(listArr[rng.Next(0, listArr.Length)]).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Games
if (string.IsNullOrWhiteSpace(question)) if (string.IsNullOrWhiteSpace(question))
return; return;
var rng = new Random(); var rng = new Random();
await imsg.Channel.SendMessageAsync($@":question: `Question` __**{question}**__ await channel.SendMessageAsync($@":question: `Question` __**{question}**__
🎱 `8Ball Answers` __**{_8BallResponses.Shuffle().FirstOrDefault()}**__").ConfigureAwait(false); 🎱 `8Ball Answers` __**{_8BallResponses.Shuffle().FirstOrDefault()}**__").ConfigureAwait(false);
} }
@ -93,7 +93,7 @@ namespace NadekoBot.Modules.Games
else else
msg = $"{imsg.Author.Mention} won! :{GetRPSPick(pick)}: beats :{GetRPSPick(nadekoPick)}:"; msg = $"{imsg.Author.Mention} won! :{GetRPSPick(pick)}: beats :{GetRPSPick(nadekoPick)}:";
await imsg.Channel.SendMessageAsync(msg).ConfigureAwait(false); await channel.SendMessageAsync(msg).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Games
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendMessageAsync( await channel.SendMessageAsync(
$@"I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX. $@"I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the {guhnoo} system every day, without realizing it. Through a peculiar turn of events, the version of {guhnoo} which is widely used today is often called {loonix}, and many of its users are not aware that it is basically the {guhnoo} system, developed by the {guhnoo} Project. Many computer users run a modified version of the {guhnoo} system every day, without realizing it. Through a peculiar turn of events, the version of {guhnoo} which is widely used today is often called {loonix}, and many of its users are not aware that it is basically the {guhnoo} system, developed by the {guhnoo} Project.

View File

@ -30,7 +30,7 @@ namespace NadekoBot.Modules.Help
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendMessageAsync("`List of modules:` \n• " + string.Join("\n• ", _commands.Modules.Select(m => m.Name)) + $"\n`Type \"-commands module_name\" to get a list of commands in that module.`") await channel.SendMessageAsync("`List of modules:` \n• " + string.Join("\n• ", _commands.Modules.Select(m => m.Name)) + $"\n`Type \"-commands module_name\" to get a list of commands in that module.`")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
@ -49,19 +49,19 @@ namespace NadekoBot.Modules.Help
var cmdsArray = cmds as Command[] ?? cmds.ToArray(); var cmdsArray = cmds as Command[] ?? cmds.ToArray();
if (!cmdsArray.Any()) if (!cmdsArray.Any())
{ {
await imsg.Channel.SendMessageAsync("That module does not exist.").ConfigureAwait(false); await channel.SendMessageAsync("That module does not exist.").ConfigureAwait(false);
return; return;
} }
if (module != "customreactions" && module != "conversations") if (module != "customreactions" && module != "conversations")
{ {
//todo aliases //todo aliases
await imsg.Channel.SendTableAsync("`List Of Commands:`\n", cmdsArray, el => $"{el.Text,-15}").ConfigureAwait(false); await channel.SendTableAsync("`List Of Commands:`\n", cmdsArray, el => $"{el.Text,-15}").ConfigureAwait(false);
} }
else else
{ {
await imsg.Channel.SendMessageAsync("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}"))); await channel.SendMessageAsync("`List Of Commands:`\n• " + string.Join("\n• ", cmdsArray.Select(c => $"{c.Text}")));
} }
await imsg.Channel.SendMessageAsync($"`You can type \"-h command_name\" to see the help about that specific command.`").ConfigureAwait(false); await channel.SendMessageAsync($"`You can type \"-h command_name\" to see the help about that specific command.`").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Help
//todo aliases //todo aliases
if (com != null) if (com != null)
await imsg.Channel.SendMessageAsync($@"**__Help for:__ `{com.Text}`** await channel.SendMessageAsync($@"**__Help for:__ `{com.Text}`**
**Desc:** {com.Description} **Desc:** {com.Description}
**Usage:** {com.Summary}").ConfigureAwait(false); **Usage:** {com.Summary}").ConfigureAwait(false);
} }
@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Help
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendMessageAsync( await channel.SendMessageAsync(
@"**LIST OF COMMANDS**: <http://nadekobot.readthedocs.io/en/latest/Commands%20List/> @"**LIST OF COMMANDS**: <http://nadekobot.readthedocs.io/en/latest/Commands%20List/>
**Hosting Guides and docs can be found here**: <http://nadekobot.rtfd.io>").ConfigureAwait(false); **Hosting Guides and docs can be found here**: <http://nadekobot.rtfd.io>").ConfigureAwait(false);
} }
@ -129,7 +129,7 @@ namespace NadekoBot.Modules.Help
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendMessageAsync( await channel.SendMessageAsync(
$@"You can support the project on patreon. <https://patreon.com/nadekobot> or $@"You can support the project on patreon. <https://patreon.com/nadekobot> or
You can send donations to `nadekodiscordbot@gmail.com` You can send donations to `nadekodiscordbot@gmail.com`
Don't forget to leave your discord name or id in the message. Don't forget to leave your discord name or id in the message.

View File

@ -32,11 +32,11 @@ namespace NadekoBot.Modules.NSFW
if (links.All(l => l == null)) if (links.All(l => l == null))
{ {
await imsg.Channel.SendMessageAsync("`No results.`"); await channel.SendMessageAsync("`No results.`");
return; return;
} }
await imsg.Channel.SendMessageAsync(String.Join("\n\n", links)).ConfigureAwait(false); await channel.SendMessageAsync(String.Join("\n\n", links)).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -48,9 +48,9 @@ namespace NadekoBot.Modules.NSFW
tag = tag?.Trim() ?? ""; tag = tag?.Trim() ?? "";
var link = await GetDanbooruImageLink(tag).ConfigureAwait(false); var link = await GetDanbooruImageLink(tag).ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(link)) if (string.IsNullOrWhiteSpace(link))
await imsg.Channel.SendMessageAsync("Search yielded no results ;("); await channel.SendMessageAsync("Search yielded no results ;(");
else else
await imsg.Channel.SendMessageAsync(link).ConfigureAwait(false); await channel.SendMessageAsync(link).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -62,9 +62,9 @@ namespace NadekoBot.Modules.NSFW
tag = tag?.Trim() ?? ""; tag = tag?.Trim() ?? "";
var link = await GetRule34ImageLink(tag).ConfigureAwait(false); var link = await GetRule34ImageLink(tag).ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(link)) if (string.IsNullOrWhiteSpace(link))
await imsg.Channel.SendMessageAsync("Search yielded no results ;("); await channel.SendMessageAsync("Search yielded no results ;(");
else else
await imsg.Channel.SendMessageAsync(link).ConfigureAwait(false); await channel.SendMessageAsync(link).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -76,9 +76,9 @@ namespace NadekoBot.Modules.NSFW
tag = tag?.Trim() ?? ""; tag = tag?.Trim() ?? "";
var link = await GetGelbooruImageLink(tag).ConfigureAwait(false); var link = await GetGelbooruImageLink(tag).ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(link)) if (string.IsNullOrWhiteSpace(link))
await imsg.Channel.SendMessageAsync("Search yielded no results ;("); await channel.SendMessageAsync("Search yielded no results ;(");
else else
await imsg.Channel.SendMessageAsync(link).ConfigureAwait(false); await channel.SendMessageAsync(link).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -90,9 +90,9 @@ namespace NadekoBot.Modules.NSFW
tag = tag?.Trim() ?? ""; tag = tag?.Trim() ?? "";
var link = await GetE621ImageLink(tag).ConfigureAwait(false); var link = await GetE621ImageLink(tag).ConfigureAwait(false);
if (string.IsNullOrWhiteSpace(link)) if (string.IsNullOrWhiteSpace(link))
await imsg.Channel.SendMessageAsync("Search yielded no results ;("); await channel.SendMessageAsync("Search yielded no results ;(");
else else
await imsg.Channel.SendMessageAsync(link).ConfigureAwait(false); await channel.SendMessageAsync(link).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -101,7 +101,7 @@ namespace NadekoBot.Modules.NSFW
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false); await channel.SendMessageAsync("http://i.imgur.com/MZkY1md.jpg").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -116,11 +116,11 @@ namespace NadekoBot.Modules.NSFW
{ {
obj = JArray.Parse(await http.GetStringAsync($"http://api.oboobs.ru/boobs/{ new Random().Next(0, 9880) }").ConfigureAwait(false))[0]; obj = JArray.Parse(await http.GetStringAsync($"http://api.oboobs.ru/boobs/{ new Random().Next(0, 9880) }").ConfigureAwait(false))[0];
} }
await imsg.Channel.SendMessageAsync($"http://media.oboobs.ru/{ obj["preview"].ToString() }").ConfigureAwait(false); await channel.SendMessageAsync($"http://media.oboobs.ru/{ obj["preview"].ToString() }").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false);
} }
} }
@ -137,11 +137,11 @@ namespace NadekoBot.Modules.NSFW
{ {
obj = JArray.Parse(await http.GetStringAsync($"http://api.obutts.ru/butts/{ new Random().Next(0, 3873) }").ConfigureAwait(false))[0]; obj = JArray.Parse(await http.GetStringAsync($"http://api.obutts.ru/butts/{ new Random().Next(0, 3873) }").ConfigureAwait(false))[0];
} }
await imsg.Channel.SendMessageAsync($"http://media.obutts.ru/{ obj["preview"].ToString() }").ConfigureAwait(false); await channel.SendMessageAsync($"http://media.obutts.ru/{ obj["preview"].ToString() }").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 {ex.Message}").ConfigureAwait(false);
} }
} }

View File

@ -25,11 +25,11 @@
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("Failed to find that anime.").ConfigureAwait(false); // await channel.SendMessageAsync("Failed to find that anime.").ConfigureAwait(false);
// return; // return;
// } // }
// await imsg.Channel.SendMessageAsync(result.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(result.ToString()).ConfigureAwait(false);
// } // }
// [LocalizedCommand, LocalizedDescription, LocalizedSummary] // [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -46,10 +46,10 @@
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("Failed to find that manga.").ConfigureAwait(false); // await channel.SendMessageAsync("Failed to find that manga.").ConfigureAwait(false);
// return; // return;
// } // }
// await imsg.Channel.SendMessageAsync(result).ConfigureAwait(false); // await channel.SendMessageAsync(result).ConfigureAwait(false);
// } // }
// public static async Task<AnimeResult> GetAnimeData(string query) // public static async Task<AnimeResult> GetAnimeData(string query)

View File

@ -62,7 +62,7 @@
// msg += curr + "; "; // msg += curr + "; ";
// } // }
// await imsg.Channel.SendMessageAsync(msg).ConfigureAwait(false); // await channel.SendMessageAsync(msg).ConfigureAwait(false);
// }; // };
// private Func<CommandEventArgs, Task> ConvertFunc() => // private Func<CommandEventArgs, Task> ConvertFunc() =>
@ -89,7 +89,7 @@
// { // {
// Unit inUnit = new Unit(fromCode, quantity, table); // Unit inUnit = new Unit(fromCode, quantity, table);
// Unit outUnit = inUnit.Convert(toCode); // Unit outUnit = inUnit.Convert(toCode);
// await imsg.Channel.SendMessageAsync(inUnit.ToString() + " = " + outUnit.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(inUnit.ToString() + " = " + outUnit.ToString()).ConfigureAwait(false);
// } // }
// else // else
// { // {
@ -98,13 +98,13 @@
// reInitCurrencyConverterTable(); // reInitCurrencyConverterTable();
// Unit inUnit = currTable.CreateUnit(quantity, from.ToUpperInvariant()); // Unit inUnit = currTable.CreateUnit(quantity, from.ToUpperInvariant());
// Unit outUnit = inUnit.Convert(currTable.CurrencyCode(to.ToUpperInvariant())); // Unit outUnit = inUnit.Convert(currTable.CurrencyCode(to.ToUpperInvariant()));
// await imsg.Channel.SendMessageAsync(inUnit.ToString() + " = " + outUnit.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(inUnit.ToString() + " = " + outUnit.ToString()).ConfigureAwait(false);
// } // }
// } // }
// catch //(Exception ex) // catch //(Exception ex)
// { // {
// //Console.WriteLine(ex.ToString()); // //Console.WriteLine(ex.ToString());
// await imsg.Channel.SendMessageAsync("Bad input format, or sth went wrong... Try to list them with `" + Module.Prefix + "`convertlist").ConfigureAwait(false); // await channel.SendMessageAsync("Bad input format, or sth went wrong... Try to list them with `" + Module.Prefix + "`convertlist").ConfigureAwait(false);
// } // }
// }; // };

View File

@ -35,10 +35,10 @@
// string answer = Evaluate(expression); // string answer = Evaluate(expression);
// if (answer == null) // if (answer == null)
// { // {
// await imsg.Channel.SendMessageAsync($"Expression {expression} failed to evaluate"); // await channel.SendMessageAsync($"Expression {expression} failed to evaluate");
// return; // return;
// } // }
// await imsg.Channel.SendMessageAsync($"⚙ `{answer}`"); // await channel.SendMessageAsync($"⚙ `{answer}`");
// }; // };
// private string Evaluate(string expression) // private string Evaluate(string expression)

View File

@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Searches.Commands
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
var response = await http.GetStringAsync("http://api.yomomma.info/").ConfigureAwait(false); var response = await http.GetStringAsync("http://api.yomomma.info/").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false); await channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false);
} }
} }
@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Searches.Commands
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false); var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false); await channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false);
} }
} }
@ -60,7 +60,7 @@ namespace NadekoBot.Modules.Searches.Commands
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false); var response = await http.GetStringAsync("http://tambal.azurewebsites.net/joke/random").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false); await channel.SendMessageAsync("`" + JObject.Parse(response)["joke"].ToString() + "` 😆").ConfigureAwait(false);
} }
} }
@ -73,7 +73,7 @@ namespace NadekoBot.Modules.Searches.Commands
if (!wowJokes.Any()) if (!wowJokes.Any())
{ {
} }
await imsg.Channel.SendMessageAsync(wowJokes[new Random().Next(0, wowJokes.Count)].ToString()); await channel.SendMessageAsync(wowJokes[new Random().Next(0, wowJokes.Count)].ToString());
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Searches.Commands
var rng = new Random(); var rng = new Random();
var item = magicItems[rng.Next(0, magicItems.Count)].ToString(); var item = magicItems[rng.Next(0, magicItems.Count)].ToString();
await imsg.Channel.SendMessageAsync(item).ConfigureAwait(false); await channel.SendMessageAsync(item).ConfigureAwait(false);
} }
} }
} }

View File

@ -107,7 +107,7 @@
// } // }
// if (data == null) // if (data == null)
// { // {
// await imsg.Channel.SendMessageAsync("💢 Data for that role does not exist.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 Data for that role does not exist.").ConfigureAwait(false);
// return; // return;
// } // }
// } // }
@ -276,7 +276,7 @@
// catch (Exception ex) // catch (Exception ex)
// { // {
// Console.WriteLine(ex); // Console.WriteLine(ex);
// await imsg.Channel.SendMessageAsync("💢 Failed retreiving data for that champion.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 Failed retreiving data for that champion.").ConfigureAwait(false);
// } // }
// }); // });
@ -308,11 +308,11 @@
// //sb.AppendLine($" ({dataList[i]["general"]["banRate"]}%)"); // //sb.AppendLine($" ({dataList[i]["general"]["banRate"]}%)");
// } // }
// await imsg.Channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
// } // }
// catch (Exception) // catch (Exception)
// { // {
// await imsg.Channel.SendMessageAsync($":anger: Fail: Champion.gg didsabled ban data until next patch. Sorry for the inconvenience.").ConfigureAwait(false); // await channel.SendMessageAsync($":anger: Fail: Champion.gg didsabled ban data until next patch. Sorry for the inconvenience.").ConfigureAwait(false);
// } // }
// }); // });
// } // }

View File

@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Searches.Commands
var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(await http.GetStringAsync("http://memegen.link/templates/")) var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(await http.GetStringAsync("http://memegen.link/templates/"))
.Select(kvp => Path.GetFileName(kvp.Value)); .Select(kvp => Path.GetFileName(kvp.Value));
await imsg.Channel.SendTableAsync(data, x => $"{x,-17}", 3); await channel.SendTableAsync(data, x => $"{x,-17}", 3);
} }
} }
@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Searches.Commands
var top = Uri.EscapeDataString(topText.Replace(' ', '-')); var top = Uri.EscapeDataString(topText.Replace(' ', '-'));
var bot = Uri.EscapeDataString(botText.Replace(' ', '-')); var bot = Uri.EscapeDataString(botText.Replace(' ', '-'));
await imsg.Channel.SendMessageAsync($"http://memegen.link/{meme}/{top}/{bot}.jpg"); await channel.SendMessageAsync($"http://memegen.link/{meme}/{top}/{bot}.jpg");
} }
} }
} }

View File

@ -44,14 +44,14 @@
// try // try
// { // {
// await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result)).ConfigureAwait(false); // await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result)).ConfigureAwait(false);
// await imsg.Channel.SendMessageAsync($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`").ConfigureAwait(false); // await channel.SendMessageAsync($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`").ConfigureAwait(false);
// } // }
// catch { } // catch { }
// }; // };
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("💢 Failed retrieving osu signature :\\").ConfigureAwait(false); // await channel.SendMessageAsync("💢 Failed retrieving osu signature :\\").ConfigureAwait(false);
// } // }
// } // }
// }); // });
@ -63,7 +63,7 @@
// { // {
// if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey)) // if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey))
// { // {
// await imsg.Channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
// return; // return;
// } // }
@ -80,11 +80,11 @@
// var time = TimeSpan.FromSeconds(Double.Parse($"{obj["total_length"]}")).ToString(@"mm\:ss"); // var time = TimeSpan.FromSeconds(Double.Parse($"{obj["total_length"]}")).ToString(@"mm\:ss");
// sb.AppendLine($"{obj["artist"]} - {obj["title"]}, mapped by {obj["creator"]}. https://osu.ppy.sh/s/{obj["beatmapset_id"]}"); // sb.AppendLine($"{obj["artist"]} - {obj["title"]}, mapped by {obj["creator"]}. https://osu.ppy.sh/s/{obj["beatmapset_id"]}");
// sb.AppendLine($"{starRating} stars, {obj["bpm"]} BPM | AR{obj["diff_approach"]}, CS{obj["diff_size"]}, OD{obj["diff_overall"]} | Length: {time}"); // sb.AppendLine($"{starRating} stars, {obj["bpm"]} BPM | AR{obj["diff_approach"]}, CS{obj["diff_size"]}, OD{obj["diff_overall"]} | Length: {time}");
// await imsg.Channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("Something went wrong."); // await channel.SendMessageAsync("Something went wrong.");
// } // }
// }); // });
@ -96,13 +96,13 @@
// { // {
// if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey)) // if (string.IsNullOrWhiteSpace(NadekoBot.Creds.OsuAPIKey))
// { // {
// await imsg.Channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 An osu! API key is required.").ConfigureAwait(false);
// return; // return;
// } // }
// if (string.IsNullOrWhiteSpace(e.GetArg("usr"))) // if (string.IsNullOrWhiteSpace(e.GetArg("usr")))
// { // {
// await imsg.Channel.SendMessageAsync("💢 Please provide a username.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 Please provide a username.").ConfigureAwait(false);
// return; // return;
// } // }
@ -130,11 +130,11 @@
// sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | /b/{item["beatmap_id"]}"); // sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | /b/{item["beatmap_id"]}");
// } // }
// sb.Append("```"); // sb.Append("```");
// await imsg.Channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); // await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false);
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("Something went wrong."); // await channel.SendMessageAsync("Something went wrong.");
// } // }
// }); // });
// } // }

View File

@ -38,11 +38,11 @@ namespace NadekoBot.Modules.Searches.Commands
{ {
if (kvp.Key.ToUpperInvariant() == pokemon.ToUpperInvariant()) if (kvp.Key.ToUpperInvariant() == pokemon.ToUpperInvariant())
{ {
await imsg.Channel.SendMessageAsync($"`Stats for \"{kvp.Key}\" pokemon:`\n{kvp.Value}"); await channel.SendMessageAsync($"`Stats for \"{kvp.Key}\" pokemon:`\n{kvp.Value}");
return; return;
} }
} }
await imsg.Channel.SendMessageAsync("`No pokemon found.`"); await channel.SendMessageAsync("`No pokemon found.`");
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -58,11 +58,11 @@ namespace NadekoBot.Modules.Searches.Commands
{ {
if (kvp.Key.ToUpperInvariant() == ability) if (kvp.Key.ToUpperInvariant() == ability)
{ {
await imsg.Channel.SendMessageAsync($"`Info for \"{kvp.Key}\" ability:`\n{kvp.Value}"); await channel.SendMessageAsync($"`Info for \"{kvp.Key}\" ability:`\n{kvp.Value}");
return; return;
} }
} }
await imsg.Channel.SendMessageAsync("`No ability found.`"); await channel.SendMessageAsync("`No ability found.`");
} }
} }
} }

View File

@ -166,12 +166,12 @@
// })); // }));
// if (streamStatus.Item1) // if (streamStatus.Item1)
// { // {
// await imsg.Channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`"); // await channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`");
// } // }
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("No channel found."); // await channel.SendMessageAsync("No channel found.");
// } // }
// }); // });
@ -195,12 +195,12 @@
// })); // }));
// if (streamStatus.Item1) // if (streamStatus.Item1)
// { // {
// await imsg.Channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`"); // await channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`");
// } // }
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("No channel found."); // await channel.SendMessageAsync("No channel found.");
// } // }
// }); // });
@ -224,12 +224,12 @@
// })); // }));
// if (streamStatus.Item1) // if (streamStatus.Item1)
// { // {
// await imsg.Channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`"); // await channel.SendMessageAsync($"`Streamer {streamStatus.Item2} is online.`");
// } // }
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync("No channel found."); // await channel.SendMessageAsync("No channel found.");
// } // }
// }); // });
@ -252,13 +252,13 @@
// snc.Username.ToLower().Trim() == username); // snc.Username.ToLower().Trim() == username);
// if (toRemove == null) // if (toRemove == null)
// { // {
// await imsg.Channel.SendMessageAsync(":anger: No such stream.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger: No such stream.").ConfigureAwait(false);
// return; // return;
// } // }
// config.ObservingStreams.Remove(toRemove); // config.ObservingStreams.Remove(toRemove);
// await ConfigHandler.SaveConfig().ConfigureAwait(false); // await ConfigHandler.SaveConfig().ConfigureAwait(false);
// await imsg.Channel.SendMessageAsync($":ok: Removed `{toRemove.Username}`'s stream from notifications.").ConfigureAwait(false); // await channel.SendMessageAsync($":ok: Removed `{toRemove.Username}`'s stream from notifications.").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "liststreams") // cgb.CreateCommand(Module.Prefix + "liststreams")
@ -277,7 +277,7 @@
// if (streamsArray.Length == 0) // if (streamsArray.Length == 0)
// { // {
// await imsg.Channel.SendMessageAsync("You are not following any streams on this server.").ConfigureAwait(false); // await channel.SendMessageAsync("You are not following any streams on this server.").ConfigureAwait(false);
// return; // return;
// } // }
@ -291,7 +291,7 @@
// return ""; // return "";
// })); // }));
// await imsg.Channel.SendMessageAsync($"You are following **{streamsArray.Length}** streams on this server.\n\n" + text).ConfigureAwait(false); // await channel.SendMessageAsync($"You are following **{streamsArray.Length}** streams on this server.\n\n" + text).ConfigureAwait(false);
// }); // });
// } // }
@ -314,7 +314,7 @@
// var exists = config.ObservingStreams.Contains(stream); // var exists = config.ObservingStreams.Contains(stream);
// if (exists) // if (exists)
// { // {
// await imsg.Channel.SendMessageAsync(":anger: I am already notifying that stream on this channel.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger: I am already notifying that stream on this channel.").ConfigureAwait(false);
// return; // return;
// } // }
// Tuple<bool, string> data; // Tuple<bool, string> data;
@ -324,7 +324,7 @@
// } // }
// catch // catch
// { // {
// await imsg.Channel.SendMessageAsync(":anger: Stream probably doesn't exist.").ConfigureAwait(false); // await channel.SendMessageAsync(":anger: Stream probably doesn't exist.").ConfigureAwait(false);
// return; // return;
// } // }
// var msg = $"Stream is currently **{(data.Item1 ? "ONLINE" : "OFFLINE")}** with **{data.Item2}** viewers"; // var msg = $"Stream is currently **{(data.Item1 ? "ONLINE" : "OFFLINE")}** with **{data.Item2}** viewers";
@ -340,7 +340,7 @@
// stream.LastStatus = data.Item1; // stream.LastStatus = data.Item1;
// if (!exists) // if (!exists)
// msg = $":ok: I will notify this channel when status changes.\n{msg}"; // msg = $":ok: I will notify this channel when status changes.\n{msg}";
// await imsg.Channel.SendMessageAsync(msg).ConfigureAwait(false); // await channel.SendMessageAsync(msg).ConfigureAwait(false);
// config.ObservingStreams.Add(stream); // config.ObservingStreams.Add(stream);
// }; // };
// } // }

View File

@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Searches
var obj = JObject.Parse(response)["weather"]; var obj = JObject.Parse(response)["weather"];
await imsg.Channel.SendMessageAsync( await channel.SendMessageAsync(
$@"🌍 **Weather for** 【{obj["target"]}】 $@"🌍 **Weather for** 【{obj["target"]}】
📏 **Lat,Long:** ({obj["latitude"]}, {obj["longitude"]}) **Condition:** {obj["condition"]} 📏 **Lat,Long:** ({obj["latitude"]}, {obj["longitude"]}) **Condition:** {obj["condition"]}
😓 **Humidity:** {obj["humidity"]}% 💨 **Wind Speed:** {obj["windspeedk"]}km/h / {obj["windspeedm"]}mph 😓 **Humidity:** {obj["humidity"]}% 💨 **Wind Speed:** {obj["windspeedk"]}km/h / {obj["windspeedm"]}mph
@ -56,11 +56,11 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var result = (await _yt.FindVideosByKeywordsAsync(query, 1)).FirstOrDefault(); var result = (await _yt.FindVideosByKeywordsAsync(query, 1)).FirstOrDefault();
if (string.IsNullOrWhiteSpace(result)) if (string.IsNullOrWhiteSpace(result))
{ {
await imsg.Channel.SendMessageAsync("No results found for that query."); await channel.SendMessageAsync("No results found for that query.");
return; return;
} }
var shortUrl = await result.ShortenUrl().ConfigureAwait(false); var shortUrl = await result.ShortenUrl().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(shortUrl).ConfigureAwait(false); await channel.SendMessageAsync(shortUrl).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -80,11 +80,11 @@ $@"🌍 **Weather for** 【{obj["target"]}】
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("Failed to find that movie.").ConfigureAwait(false); await channel.SendMessageAsync("Failed to find that movie.").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.SendMessageAsync(result.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(result.ToString()).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -94,7 +94,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
await imsg.Channel.SendMessageAsync(JObject.Parse( await channel.SendMessageAsync(JObject.Parse(
await http.GetStringAsync("http://www.random.cat/meow").ConfigureAwait(false))["file"].ToString()) await http.GetStringAsync("http://www.random.cat/meow").ConfigureAwait(false))["file"].ToString())
.ConfigureAwait(false); .ConfigureAwait(false);
} }
@ -107,7 +107,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
using (var http = new HttpClient()) using (var http = new HttpClient())
{ {
await imsg.Channel.SendMessageAsync("http://random.dog/" + await http.GetStringAsync("http://random.dog/woof").ConfigureAwait(false)).ConfigureAwait(false); await channel.SendMessageAsync("http://random.dog/" + await http.GetStringAsync("http://random.dog/woof").ConfigureAwait(false)).ConfigureAwait(false);
} }
} }
@ -125,18 +125,18 @@ $@"🌍 **Weather for** 【{obj["target"]}】
{ {
var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(query)}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&fields=items%2Flink&key={NadekoBot.Credentials.GoogleApiKey}"; var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(query)}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&fields=items%2Flink&key={NadekoBot.Credentials.GoogleApiKey}";
var obj = JObject.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false)); var obj = JObject.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false));
await imsg.Channel.SendMessageAsync(obj["items"][0]["link"].ToString()).ConfigureAwait(false); await channel.SendMessageAsync(obj["items"][0]["link"].ToString()).ConfigureAwait(false);
} }
} }
catch (HttpRequestException exception) catch (HttpRequestException exception)
{ {
if (exception.Message.Contains("403 (Forbidden)")) if (exception.Message.Contains("403 (Forbidden)"))
{ {
await imsg.Channel.SendMessageAsync("Daily limit reached!"); await channel.SendMessageAsync("Daily limit reached!");
} }
else else
{ {
await imsg.Channel.SendMessageAsync("Something went wrong."); await channel.SendMessageAsync("Something went wrong.");
} }
} }
} }
@ -157,18 +157,18 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(query)}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&start={ rng.Next(1, 50) }&fields=items%2Flink&key={NadekoBot.Credentials.GoogleApiKey}"; var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(query)}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&start={ rng.Next(1, 50) }&fields=items%2Flink&key={NadekoBot.Credentials.GoogleApiKey}";
var obj = JObject.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false)); var obj = JObject.Parse(await http.GetStringAsync(reqString).ConfigureAwait(false));
var items = obj["items"] as JArray; var items = obj["items"] as JArray;
await imsg.Channel.SendMessageAsync(items[0]["link"].ToString()).ConfigureAwait(false); await channel.SendMessageAsync(items[0]["link"].ToString()).ConfigureAwait(false);
} }
} }
catch (HttpRequestException exception) catch (HttpRequestException exception)
{ {
if (exception.Message.Contains("403 (Forbidden)")) if (exception.Message.Contains("403 (Forbidden)"))
{ {
await imsg.Channel.SendMessageAsync("Daily limit reached!"); await channel.SendMessageAsync("Daily limit reached!");
} }
else else
{ {
await imsg.Channel.SendMessageAsync("Something went wrong."); await channel.SendMessageAsync("Something went wrong.");
} }
} }
} }
@ -183,7 +183,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
if (string.IsNullOrWhiteSpace(ffs)) if (string.IsNullOrWhiteSpace(ffs))
return; return;
await imsg.Channel.SendMessageAsync(await $"<http://lmgtfy.com/?q={ Uri.EscapeUriString(ffs) }>".ShortenUrl()) await channel.SendMessageAsync(await $"<http://lmgtfy.com/?q={ Uri.EscapeUriString(ffs) }>".ShortenUrl())
.ConfigureAwait(false); .ConfigureAwait(false);
} }
@ -197,7 +197,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
terms = terms?.Trim(); terms = terms?.Trim();
if (string.IsNullOrWhiteSpace(terms)) if (string.IsNullOrWhiteSpace(terms))
return; return;
await imsg.Channel.SendMessageAsync($"https://google.com/search?q={ WebUtility.UrlEncode(terms).Replace(' ', '+') }") await channel.SendMessageAsync($"https://google.com/search?q={ WebUtility.UrlEncode(terms).Replace(' ', '+') }")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
////todo drawing ////todo drawing
@ -209,7 +209,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
// var arg = e.GetArg("name"); // var arg = e.GetArg("name");
// if (string.IsNullOrWhiteSpace(arg)) // if (string.IsNullOrWhiteSpace(arg))
// { // {
// await imsg.Channel.SendMessageAsync("💢 Please enter a card name to search for.").ConfigureAwait(false); // await channel.SendMessageAsync("💢 Please enter a card name to search for.").ConfigureAwait(false);
// return; // return;
// } // }
// await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); // await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
@ -234,14 +234,14 @@ $@"🌍 **Weather for** 【{obj["target"]}】
// } // }
// if (items.Count > 4) // if (items.Count > 4)
// { // {
// await imsg.Channel.SendMessageAsync("⚠ Found over 4 images. Showing random 4.").ConfigureAwait(false); // await channel.SendMessageAsync("⚠ Found over 4 images. Showing random 4.").ConfigureAwait(false);
// } // }
// await imsg.Channel.SendMessageAsync(arg + ".png", (await images.MergeAsync()).ToStream(System.Drawing.Imaging.ImageFormat.Png)) // await channel.SendMessageAsync(arg + ".png", (await images.MergeAsync()).ToStream(System.Drawing.Imaging.ImageFormat.Png))
// .ConfigureAwait(false); // .ConfigureAwait(false);
// } // }
// catch (Exception ex) // catch (Exception ex)
// { // {
// await imsg.Channel.SendMessageAsync($"💢 Error {ex.Message}").ConfigureAwait(false); // await channel.SendMessageAsync($"💢 Error {ex.Message}").ConfigureAwait(false);
// } // }
// } // }
//} //}
@ -255,7 +255,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var arg = query; var arg = query;
if (string.IsNullOrWhiteSpace(arg)) if (string.IsNullOrWhiteSpace(arg))
{ {
await imsg.Channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
@ -271,11 +271,11 @@ $@"🌍 **Weather for** 【{obj["target"]}】
sb.AppendLine($"`Term:` {items["list"][0]["word"].ToString()}"); sb.AppendLine($"`Term:` {items["list"][0]["word"].ToString()}");
sb.AppendLine($"`Definition:` {items["list"][0]["definition"].ToString()}"); sb.AppendLine($"`Definition:` {items["list"][0]["definition"].ToString()}");
sb.Append($"`Link:` <{await items["list"][0]["permalink"].ToString().ShortenUrl().ConfigureAwait(false)}>"); sb.Append($"`Link:` <{await items["list"][0]["permalink"].ToString().ShortenUrl().ConfigureAwait(false)}>");
await imsg.Channel.SendMessageAsync(sb.ToString()); await channel.SendMessageAsync(sb.ToString());
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("💢 Failed finding a definition for that term.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Failed finding a definition for that term.").ConfigureAwait(false);
} }
} }
} }
@ -289,7 +289,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var arg = query; var arg = query;
if (string.IsNullOrWhiteSpace(arg)) if (string.IsNullOrWhiteSpace(arg))
{ {
await imsg.Channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
@ -307,11 +307,11 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var str = $@"`Hashtag:` {items["defs"]["def"]["hashtag"].ToString()} var str = $@"`Hashtag:` {items["defs"]["def"]["hashtag"].ToString()}
`Definition:` {items["defs"]["def"]["text"].ToString()} `Definition:` {items["defs"]["def"]["text"].ToString()}
`Link:` <{await items["defs"]["def"]["uri"].ToString().ShortenUrl().ConfigureAwait(false)}>"; `Link:` <{await items["defs"]["def"]["uri"].ToString().ShortenUrl().ConfigureAwait(false)}>";
await imsg.Channel.SendMessageAsync(str); await channel.SendMessageAsync(str);
} }
catch catch
{ {
await imsg.Channel.SendMessageAsync("💢 Failed finding a definition for that tag.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Failed finding a definition for that tag.").ConfigureAwait(false);
} }
} }
//todo DB //todo DB
@ -322,7 +322,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
// var channel = imsg.Channel as ITextChannel; // var channel = imsg.Channel as ITextChannel;
// var quote = NadekoBot.Config.Quotes[rng.Next(0, NadekoBot.Config.Quotes.Count)].ToString(); // var quote = NadekoBot.Config.Quotes[rng.Next(0, NadekoBot.Config.Quotes.Count)].ToString();
// await imsg.Channel.SendMessageAsync(quote).ConfigureAwait(false); // await channel.SendMessageAsync(quote).ConfigureAwait(false);
//} //}
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -335,7 +335,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var response = await http.GetStringAsync("http://catfacts-api.appspot.com/api/facts").ConfigureAwait(false); var response = await http.GetStringAsync("http://catfacts-api.appspot.com/api/facts").ConfigureAwait(false);
if (response == null) if (response == null)
return; return;
await imsg.Channel.SendMessageAsync($"🐈 `{JObject.Parse(response)["facts"][0].ToString()}`").ConfigureAwait(false); await channel.SendMessageAsync($"🐈 `{JObject.Parse(response)["facts"][0].ToString()}`").ConfigureAwait(false);
} }
} }
@ -353,7 +353,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
if (usr == null || string.IsNullOrWhiteSpace(usr.AvatarUrl)) if (usr == null || string.IsNullOrWhiteSpace(usr.AvatarUrl))
return; return;
await imsg.Channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={usr.AvatarUrl}").ConfigureAwait(false); await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={usr.AvatarUrl}").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -365,7 +365,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
if (string.IsNullOrWhiteSpace(imageLink)) if (string.IsNullOrWhiteSpace(imageLink))
return; return;
await imsg.Channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={imageLink}").ConfigureAwait(false); await channel.SendMessageAsync($"https://images.google.com/searchbyimage?image_url={imageLink}").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -377,9 +377,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】
tag = tag?.Trim() ?? ""; tag = tag?.Trim() ?? "";
var link = await GetSafebooruImageLink(tag).ConfigureAwait(false); var link = await GetSafebooruImageLink(tag).ConfigureAwait(false);
if (link == null) if (link == null)
await imsg.Channel.SendMessageAsync("`No results.`"); await channel.SendMessageAsync("`No results.`");
else else
await imsg.Channel.SendMessageAsync(link).ConfigureAwait(false); await channel.SendMessageAsync(link).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -396,9 +396,9 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var result = await http.GetStringAsync("https://en.wikipedia.org//w/api.php?action=query&format=json&prop=info&redirects=1&formatversion=2&inprop=url&titles=" + Uri.EscapeDataString(query)); var result = await http.GetStringAsync("https://en.wikipedia.org//w/api.php?action=query&format=json&prop=info&redirects=1&formatversion=2&inprop=url&titles=" + Uri.EscapeDataString(query));
var data = JsonConvert.DeserializeObject<WikipediaApiModel>(result); var data = JsonConvert.DeserializeObject<WikipediaApiModel>(result);
if (data.Query.Pages[0].Missing) if (data.Query.Pages[0].Missing)
await imsg.Channel.SendMessageAsync("`That page could not be found.`"); await channel.SendMessageAsync("`That page could not be found.`");
else else
await imsg.Channel.SendMessageAsync(data.Query.Pages[0].FullUrl); await channel.SendMessageAsync(data.Query.Pages[0].FullUrl);
} }
} }
@ -425,7 +425,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】
// g.Flush(); // g.Flush();
// } // }
// await imsg.Channel.SendFileAsync("arg1.png", img.ToStream()); // await channel.SendFileAsync("arg1.png", img.ToStream());
//} //}
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -460,10 +460,10 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var usr = imsg.MentionedUsers.FirstOrDefault(); var usr = imsg.MentionedUsers.FirstOrDefault();
if (usr == null) if (usr == null)
{ {
await imsg.Channel.SendMessageAsync("Invalid user specified.").ConfigureAwait(false); await channel.SendMessageAsync("Invalid user specified.").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.SendMessageAsync(await usr.AvatarUrl.ShortenUrl()).ConfigureAwait(false); await channel.SendMessageAsync(await usr.AvatarUrl.ShortenUrl()).ConfigureAwait(false);
} }
public static async Task<string> GetSafebooruImageLink(string tag) public static async Task<string> GetSafebooruImageLink(string tag)

View File

@ -34,12 +34,12 @@ namespace NadekoBot.Modules.Translator
await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await imsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
string translation = await GoogleTranslator.Instance.Translate(text, from, to).ConfigureAwait(false); string translation = await GoogleTranslator.Instance.Translate(text, from, to).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(translation).ConfigureAwait(false); await channel.SendMessageAsync(translation).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex); Console.WriteLine(ex);
await imsg.Channel.SendMessageAsync("Bad input format, or something went wrong...").ConfigureAwait(false); await channel.SendMessageAsync("Bad input format, or something went wrong...").ConfigureAwait(false);
} }
} }
@ -49,7 +49,7 @@ namespace NadekoBot.Modules.Translator
{ {
var channel = imsg.Channel as ITextChannel; var channel = imsg.Channel as ITextChannel;
await imsg.Channel.SendTableAsync(GoogleTranslator.Instance.Languages, str => str, columns: 4); await channel.SendTableAsync(GoogleTranslator.Instance.Languages, str => str, columns: 4);
} }
} }

View File

@ -82,7 +82,7 @@
// bound = e.Channel; // bound = e.Channel;
// board = new Board(e.GetArg("board_id").Trim()); // board = new Board(e.GetArg("board_id").Trim());
// board.Refresh(); // board.Refresh();
// await imsg.Channel.SendMessageAsync("Successfully bound to this channel and board " + board.Name); // await channel.SendMessageAsync("Successfully bound to this channel and board " + board.Name);
// t.Start(); // t.Start();
// } // }
// catch (Exception ex) // catch (Exception ex)
@ -100,7 +100,7 @@
// t.Stop(); // t.Stop();
// bound = null; // bound = null;
// board = null; // board = null;
// await imsg.Channel.SendMessageAsync("Successfully unbound trello from this channel.").ConfigureAwait(false); // await channel.SendMessageAsync("Successfully unbound trello from this channel.").ConfigureAwait(false);
// }); // });
@ -111,7 +111,7 @@
// { // {
// if (!NadekoBot.IsOwner(e.User.Id)) return; // if (!NadekoBot.IsOwner(e.User.Id)) return;
// if (bound == null || board == null || bound != e.Channel) return; // if (bound == null || board == null || bound != e.Channel) return;
// await imsg.Channel.SendMessageAsync("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**"))) // await channel.SendMessageAsync("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**")))
// .ConfigureAwait(false); // .ConfigureAwait(false);
// }); // });
@ -133,10 +133,10 @@
// if (list != null) // if (list != null)
// await imsg.Channel.SendMessageAsync("There are " + list.Cards.Count() + " cards in a **" + list.Name + "** list\n" + string.Join("\n", list.Cards.Select(c => "**• " + c.ToString() + "**"))) // await channel.SendMessageAsync("There are " + list.Cards.Count() + " cards in a **" + list.Name + "** list\n" + string.Join("\n", list.Cards.Select(c => "**• " + c.ToString() + "**")))
// .ConfigureAwait(false); // .ConfigureAwait(false);
// else // else
// await imsg.Channel.SendMessageAsync("No such list.") // await channel.SendMessageAsync("No such list.")
// .ConfigureAwait(false); // .ConfigureAwait(false);
// }); // });
// }); // });

View File

@ -113,7 +113,7 @@
// if (ch == null) // if (ch == null)
// { // {
// await imsg.Channel.SendMessageAsync($"{e.User.Mention} Something went wrong (channel cannot be found) ;(").ConfigureAwait(false); // await channel.SendMessageAsync($"{e.User.Mention} Something went wrong (channel cannot be found) ;(").ConfigureAwait(false);
// return; // return;
// } // }
@ -123,7 +123,7 @@
// if (m.Length == 0) // if (m.Length == 0)
// { // {
// await imsg.Channel.SendMessageAsync("Not a valid time format blablabla").ConfigureAwait(false); // await channel.SendMessageAsync("Not a valid time format blablabla").ConfigureAwait(false);
// return; // return;
// } // }
@ -148,7 +148,7 @@
// (groupName == "hours" && value > 23) || // (groupName == "hours" && value > 23) ||
// (groupName == "minutes" && value > 59)) // (groupName == "minutes" && value > 59))
// { // {
// await imsg.Channel.SendMessageAsync($"Invalid {groupName} value.").ConfigureAwait(false); // await channel.SendMessageAsync($"Invalid {groupName} value.").ConfigureAwait(false);
// return; // return;
// } // }
// else // else
@ -175,7 +175,7 @@
// reminders.Add(StartNewReminder(rem)); // reminders.Add(StartNewReminder(rem));
// await imsg.Channel.SendMessageAsync($"⏰ I will remind \"{ch.Name}\" to \"{e.GetArg("message").ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false); // await channel.SendMessageAsync($"⏰ I will remind \"{ch.Name}\" to \"{e.GetArg("message").ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false);
// }); // });
// cgb.CreateCommand(Module.Prefix + "remindmsg") // cgb.CreateCommand(Module.Prefix + "remindmsg")
// .Description("Sets message for when the remind is triggered. " + // .Description("Sets message for when the remind is triggered. " +
@ -190,7 +190,7 @@
// return; // return;
// NadekoBot.Config.RemindMessageFormat = arg; // NadekoBot.Config.RemindMessageFormat = arg;
// await imsg.Channel.SendMessageAsync("`New remind message set.`"); // await channel.SendMessageAsync("`New remind message set.`");
// }); // });
// } // }
// } // }

View File

@ -37,9 +37,9 @@ namespace NadekoBot.Modules.Utility
int i = 0; int i = 0;
if (!arr.Any()) if (!arr.Any())
await imsg.Channel.SendMessageAsync(_l["`Nobody is playing that game.`"]).ConfigureAwait(false); await channel.SendMessageAsync(_l["`Nobody is playing that game.`"]).ConfigureAwait(false);
else else
await imsg.Channel.SendMessageAsync("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false); await channel.SendMessageAsync("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Concat(ig.Select(el => $"• {el,-35}")))) + "\n```").ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
@ -63,16 +63,16 @@ namespace NadekoBot.Modules.Utility
{ {
if (!usr.GetPermissions(channel).ManageMessages) if (!usr.GetPermissions(channel).ManageMessages)
{ {
await imsg.Channel.SendMessageAsync($"{usr.Mention} you are not allowed to use this command on roles with a lot of users in them to prevent abuse."); await channel.SendMessageAsync($"{usr.Mention} you are not allowed to use this command on roles with a lot of users in them to prevent abuse.");
return; return;
} }
var curstr = send.Substring(0, 2000); var curstr = send.Substring(0, 2000);
await imsg.Channel.SendMessageAsync(curstr.Substring(0, await channel.SendMessageAsync(curstr.Substring(0,
curstr.LastIndexOf(", ", StringComparison.Ordinal) + 1)).ConfigureAwait(false); curstr.LastIndexOf(", ", StringComparison.Ordinal) + 1)).ConfigureAwait(false);
send = curstr.Substring(curstr.LastIndexOf(", ", StringComparison.Ordinal) + 1) + send = curstr.Substring(curstr.LastIndexOf(", ", StringComparison.Ordinal) + 1) +
send.Substring(2000); send.Substring(2000);
} }
await imsg.Channel.SendMessageAsync(send).ConfigureAwait(false); await channel.SendMessageAsync(send).ConfigureAwait(false);
} }
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]

View File

@ -58,7 +58,7 @@ namespace NadekoBot.Modules.CustomReactions
commandFuncs.Keys.ForEach(key => str = key.Replace(str, m => commandFuncs[key](e, m))); commandFuncs.Keys.ForEach(key => str = key.Replace(str, m => commandFuncs[key](e, m)));
await imsg.Channel.SendMessageAsync(str).ConfigureAwait(false); await channel.SendMessageAsync(str).ConfigureAwait(false);
}); });
} }
}); });

View File

@ -92,9 +92,9 @@ namespace NadekoBot.Modules.Music
return; return;
musicPlayer.TogglePause(); musicPlayer.TogglePause();
if (musicPlayer.Paused) if (musicPlayer.Paused)
await imsg.Channel.SendMessageAsync("🎵`Music Player paused.`").ConfigureAwait(false); await channel.SendMessageAsync("🎵`Music Player paused.`").ConfigureAwait(false);
else else
await imsg.Channel.SendMessageAsync("🎵`Music Player unpaused.`").ConfigureAwait(false); await channel.SendMessageAsync("🎵`Music Player unpaused.`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "queue") cgb.CreateCommand(Prefix + "queue")
@ -137,7 +137,7 @@ namespace NadekoBot.Modules.Music
MusicPlayer musicPlayer; MusicPlayer musicPlayer;
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
{ {
await imsg.Channel.SendMessageAsync("🎵 No active music player.").ConfigureAwait(false); await channel.SendMessageAsync("🎵 No active music player.").ConfigureAwait(false);
return; return;
} }
@ -163,7 +163,7 @@ namespace NadekoBot.Modules.Music
const int itemsPerPage = 15; const int itemsPerPage = 15;
int startAt = itemsPerPage * (page - 1); int startAt = itemsPerPage * (page - 1);
var number = 1 + startAt; var number = 1 + startAt;
await imsg.Channel.SendMessageAsync(toSend + string.Join("\n", musicPlayer.Playlist.Skip(startAt).Take(15).Select(v => $"`{number++}.` {v.PrettyName}"))).ConfigureAwait(false); await channel.SendMessageAsync(toSend + string.Join("\n", musicPlayer.Playlist.Skip(startAt).Take(15).Select(v => $"`{number++}.` {v.PrettyName}"))).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "nowplaying") cgb.CreateCommand(Prefix + "nowplaying")
@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Music
var currentSong = musicPlayer.CurrentSong; var currentSong = musicPlayer.CurrentSong;
if (currentSong == null) if (currentSong == null)
return; return;
await imsg.Channel.SendMessageAsync($"🎵`Now Playing` {currentSong.PrettyName} " + await channel.SendMessageAsync($"🎵`Now Playing` {currentSong.PrettyName} " +
$"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false); $"{currentSong.PrettyCurrentTime()}").ConfigureAwait(false);
}); });
@ -196,11 +196,11 @@ namespace NadekoBot.Modules.Music
int volume; int volume;
if (!int.TryParse(arg, out volume)) if (!int.TryParse(arg, out volume))
{ {
await imsg.Channel.SendMessageAsync("Volume number invalid.").ConfigureAwait(false); await channel.SendMessageAsync("Volume number invalid.").ConfigureAwait(false);
return; return;
} }
volume = musicPlayer.SetVolume(volume); volume = musicPlayer.SetVolume(volume);
await imsg.Channel.SendMessageAsync($"🎵 `Volume set to {volume}%`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Volume set to {volume}%`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "defvol") cgb.CreateCommand(Prefix + "defvol")
@ -214,12 +214,12 @@ namespace NadekoBot.Modules.Music
float volume; float volume;
if (!float.TryParse(arg, out volume) || volume < 0 || volume > 100) if (!float.TryParse(arg, out volume) || volume < 0 || volume > 100)
{ {
await imsg.Channel.SendMessageAsync("Volume number invalid.").ConfigureAwait(false); await channel.SendMessageAsync("Volume number invalid.").ConfigureAwait(false);
return; return;
} }
var conf = SpecificConfigurations.Default.Of(e.Server.Id); var conf = SpecificConfigurations.Default.Of(e.Server.Id);
conf.DefaultMusicVolume = volume / 100; conf.DefaultMusicVolume = volume / 100;
await imsg.Channel.SendMessageAsync($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Default volume set to {volume}%`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "mute") cgb.CreateCommand(Prefix + "mute")
@ -271,12 +271,12 @@ namespace NadekoBot.Modules.Music
return; return;
if (musicPlayer.Playlist.Count < 2) if (musicPlayer.Playlist.Count < 2)
{ {
await imsg.Channel.SendMessageAsync("💢 Not enough songs in order to perform the shuffle.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Not enough songs in order to perform the shuffle.").ConfigureAwait(false);
return; return;
} }
musicPlayer.Shuffle(); musicPlayer.Shuffle();
await imsg.Channel.SendMessageAsync("🎵 `Songs shuffled.`").ConfigureAwait(false); await channel.SendMessageAsync("🎵 `Songs shuffled.`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "playlist") cgb.CreateCommand(Prefix + "playlist")
@ -290,25 +290,25 @@ namespace NadekoBot.Modules.Music
return; return;
if (e.User.VoiceChannel?.Server != e.Server) if (e.User.VoiceChannel?.Server != e.Server)
{ {
await imsg.Channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false); await channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false);
return; return;
} }
var plId = await SearchHelper.GetPlaylistIdByKeyword(arg).ConfigureAwait(false); var plId = await SearchHelper.GetPlaylistIdByKeyword(arg).ConfigureAwait(false);
if (plId == null) if (plId == null)
{ {
await imsg.Channel.SendMessageAsync("No search results for that query."); await channel.SendMessageAsync("No search results for that query.");
return; return;
} }
var ids = await SearchHelper.GetVideoIDs(plId, 500).ConfigureAwait(false); var ids = await SearchHelper.GetVideoIDs(plId, 500).ConfigureAwait(false);
if (ids == null || ids.Count == 0) if (ids == null || ids.Count == 0)
{ {
await imsg.Channel.SendMessageAsync($"🎵 `Failed to find any songs.`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Failed to find any songs.`").ConfigureAwait(false);
return; return;
} }
var idArray = ids as string[] ?? ids.ToArray(); var idArray = ids as string[] ?? ids.ToArray();
var count = idArray.Length; var count = idArray.Length;
var msg = var msg =
await imsg.Channel.SendMessageAsync($"🎵 `Attempting to queue {count} songs".SnPl(count) + "...`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Attempting to queue {count} songs".SnPl(count) + "...`").ConfigureAwait(false);
foreach (var id in idArray) foreach (var id in idArray)
{ {
try try
@ -383,7 +383,7 @@ namespace NadekoBot.Modules.Music
} }
catch { } catch { }
} }
await imsg.Channel.SendMessageAsync("🎵 `Directory queue complete.`").ConfigureAwait(false); await channel.SendMessageAsync("🎵 `Directory queue complete.`").ConfigureAwait(false);
} }
catch { } catch { }
}); });
@ -395,7 +395,7 @@ namespace NadekoBot.Modules.Music
{ {
if (e.User.VoiceChannel?.Server != e.Server) if (e.User.VoiceChannel?.Server != e.Server)
{ {
await imsg.Channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false); await channel.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining it.").ConfigureAwait(false);
return; return;
} }
await QueueSong(e.User, e.Channel, e.User.VoiceChannel, e.GetArg("radio_link"), musicType: MusicType.Radio).ConfigureAwait(false); await QueueSong(e.User, e.Channel, e.User.VoiceChannel, e.GetArg("radio_link"), musicType: MusicType.Radio).ConfigureAwait(false);
@ -448,7 +448,7 @@ namespace NadekoBot.Modules.Music
if (arg?.ToLower() == "all") if (arg?.ToLower() == "all")
{ {
musicPlayer.ClearQueue(); musicPlayer.ClearQueue();
await imsg.Channel.SendMessageAsync($"🎵`Queue cleared!`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵`Queue cleared!`").ConfigureAwait(false);
return; return;
} }
int num; int num;
@ -460,7 +460,7 @@ namespace NadekoBot.Modules.Music
return; return;
var song = (musicPlayer.Playlist as List<Song>)?[num - 1]; var song = (musicPlayer.Playlist as List<Song>)?[num - 1];
musicPlayer.RemoveSongAt(num - 1); musicPlayer.RemoveSongAt(num - 1);
await imsg.Channel.SendMessageAsync($"🎵**Track {song.PrettyName} at position `#{num}` has been removed.**").ConfigureAwait(false); await channel.SendMessageAsync($"🎵**Track {song.PrettyName} at position `#{num}` has been removed.**").ConfigureAwait(false);
}); });
//var msRegex = new Regex(@"(?<n1>\d+)>(?<n2>\d+)", RegexOptions.Compiled); //var msRegex = new Regex(@"(?<n1>\d+)>(?<n2>\d+)", RegexOptions.Compiled);
@ -487,7 +487,7 @@ namespace NadekoBot.Modules.Music
!int.TryParse(fromtoArr[1], out n2) || n1 < 1 || n2 < 1 || n1 == n2 || !int.TryParse(fromtoArr[1], out n2) || n1 < 1 || n2 < 1 || n1 == n2 ||
n1 > playlist.Count || n2 > playlist.Count) n1 > playlist.Count || n2 > playlist.Count)
{ {
await imsg.Channel.SendMessageAsync("`Invalid input.`").ConfigureAwait(false); await channel.SendMessageAsync("`Invalid input.`").ConfigureAwait(false);
return; return;
} }
@ -496,7 +496,7 @@ namespace NadekoBot.Modules.Music
var nn1 = n2 < n1 ? n1 : n1 - 1; var nn1 = n2 < n1 ? n1 : n1 - 1;
playlist.RemoveAt(nn1); playlist.RemoveAt(nn1);
await imsg.Channel.SendMessageAsync($"🎵`Moved` {s.PrettyName} `from #{n1} to #{n2}`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵`Moved` {s.PrettyName} `from #{n1} to #{n2}`").ConfigureAwait(false);
}); });
@ -520,7 +520,7 @@ namespace NadekoBot.Modules.Music
} }
musicPlayer.MaxQueueSize = size; musicPlayer.MaxQueueSize = size;
await imsg.Channel.SendMessageAsync($"🎵 `Max queue set to {(size == 0 ? ("unlimited") : size + " tracks")}`"); await channel.SendMessageAsync($"🎵 `Max queue set to {(size == 0 ? ("unlimited") : size + " tracks")}`");
}); });
cgb.CreateCommand(Prefix + "cleanup") cgb.CreateCommand(Prefix + "cleanup")
@ -553,7 +553,7 @@ namespace NadekoBot.Modules.Music
if (currentSong == null) if (currentSong == null)
return; return;
var currentValue = musicPlayer.ToggleRepeatSong(); var currentValue = musicPlayer.ToggleRepeatSong();
await imsg.Channel.SendMessageAsync(currentValue ? await channel.SendMessageAsync(currentValue ?
$"🎵🔂`Repeating track:`{currentSong.PrettyName}" : $"🎵🔂`Repeating track:`{currentSong.PrettyName}" :
$"🎵🔂`Current track repeat stopped.`") $"🎵🔂`Current track repeat stopped.`")
.ConfigureAwait(false); .ConfigureAwait(false);
@ -568,7 +568,7 @@ namespace NadekoBot.Modules.Music
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer))
return; return;
var currentValue = musicPlayer.ToggleRepeatPlaylist(); var currentValue = musicPlayer.ToggleRepeatPlaylist();
await imsg.Channel.SendMessageAsync($"🎵🔁`Repeat playlist {(currentValue ? "enabled" : "disabled")}`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵🔁`Repeat playlist {(currentValue ? "enabled" : "disabled")}`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "save") cgb.CreateCommand(Prefix + "save")
@ -620,7 +620,7 @@ namespace NadekoBot.Modules.Music
SongInfoId = s.Id.Value SongInfoId = s.Id.Value
}), typeof(PlaylistSongInfo)); }), typeof(PlaylistSongInfo));
await imsg.Channel.SendMessageAsync($"🎵 `Saved playlist as {name}-{playlist.Id}`").ConfigureAwait(false); await channel.SendMessageAsync($"🎵 `Saved playlist as {name}-{playlist.Id}`").ConfigureAwait(false);
}); });
@ -655,7 +655,7 @@ namespace NadekoBot.Modules.Music
if (playlist == null) if (playlist == null)
{ {
await imsg.Channel.SendMessageAsync("Can't find playlist under that name.").ConfigureAwait(false); await channel.SendMessageAsync("Can't find playlist under that name.").ConfigureAwait(false);
return; return;
} }
@ -665,7 +665,7 @@ namespace NadekoBot.Modules.Music
var songInfos = psis.Select(psi => DbHandler.Instance var songInfos = psis.Select(psi => DbHandler.Instance
.FindOne<DataModels.SongInfo>(si => si.Id == psi.SongInfoId)); .FindOne<DataModels.SongInfo>(si => si.Id == psi.SongInfoId));
await imsg.Channel.SendMessageAsync($"`Attempting to load {songInfos.Count()} songs`").ConfigureAwait(false); await channel.SendMessageAsync($"`Attempting to load {songInfos.Count()} songs`").ConfigureAwait(false);
foreach (var si in songInfos) foreach (var si in songInfos)
{ {
try try
@ -695,9 +695,9 @@ namespace NadekoBot.Modules.Music
return; return;
var result = DbHandler.Instance.GetPlaylistData(num); var result = DbHandler.Instance.GetPlaylistData(num);
if (result.Count == 0) if (result.Count == 0)
imsg.Channel.SendMessageAsync($"`No saved playlists found on page {num}`").ConfigureAwait(false); channel.SendMessageAsync($"`No saved playlists found on page {num}`").ConfigureAwait(false);
else else
imsg.Channel.SendMessageAsync($"```js\n--- List of saved playlists ---\n\n" + string.Join("\n", result.Select(r => $"'{r.Name}-{r.Id}' by {r.Creator} ({r.SongCnt} songs)")) + $"\n\n --- Page {num} ---```").ConfigureAwait(false); channel.SendMessageAsync($"```js\n--- List of saved playlists ---\n\n" + string.Join("\n", result.Select(r => $"'{r.Name}-{r.Id}' by {r.Creator} ({r.SongCnt} songs)")) + $"\n\n --- Page {num} ---```").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "deleteplaylist") cgb.CreateCommand(Prefix + "deleteplaylist")
@ -714,7 +714,7 @@ namespace NadekoBot.Modules.Music
DbHandler.Instance.Delete<MusicPlaylist>(plnum); DbHandler.Instance.Delete<MusicPlaylist>(plnum);
else else
DbHandler.Instance.DeleteWhere<MusicPlaylist>(mp => mp.Id == plnum && (long)e.User.Id == mp.CreatorId); DbHandler.Instance.DeleteWhere<MusicPlaylist>(mp => mp.Id == plnum && (long)e.User.Id == mp.CreatorId);
await imsg.Channel.SendMessageAsync("`Ok.` :ok:").ConfigureAwait(false); await channel.SendMessageAsync("`Ok.` :ok:").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "goto") cgb.CreateCommand(Prefix + "goto")
@ -751,7 +751,7 @@ namespace NadekoBot.Modules.Music
if (seconds.Length == 1) if (seconds.Length == 1)
seconds = "0" + seconds; seconds = "0" + seconds;
await imsg.Channel.SendMessageAsync($"`Skipped to {minutes}:{seconds}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Skipped to {minutes}:{seconds}`").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "getlink") cgb.CreateCommand(Prefix + "getlink")
@ -771,12 +771,12 @@ namespace NadekoBot.Modules.Music
var selSong = musicPlayer.Playlist.DefaultIfEmpty(null).ElementAtOrDefault(index - 1); var selSong = musicPlayer.Playlist.DefaultIfEmpty(null).ElementAtOrDefault(index - 1);
if (selSong == null) if (selSong == null)
{ {
await imsg.Channel.SendMessageAsync("Could not select song, likely wrong index"); await channel.SendMessageAsync("Could not select song, likely wrong index");
} }
else else
{ {
await imsg.Channel.SendMessageAsync($"🎶`Selected song {selSong.SongInfo.Title}:` <{selSong.SongInfo.Query}>").ConfigureAwait(false); await channel.SendMessageAsync($"🎶`Selected song {selSong.SongInfo.Title}:` <{selSong.SongInfo.Query}>").ConfigureAwait(false);
} }
} }
else else
@ -784,7 +784,7 @@ namespace NadekoBot.Modules.Music
var curSong = musicPlayer.CurrentSong; var curSong = musicPlayer.CurrentSong;
if (curSong == null) if (curSong == null)
return; return;
await imsg.Channel.SendMessageAsync($"🎶`Current song:` <{curSong.SongInfo.Query}>").ConfigureAwait(false); await channel.SendMessageAsync($"🎶`Current song:` <{curSong.SongInfo.Query}>").ConfigureAwait(false);
} }
}); });
@ -800,9 +800,9 @@ namespace NadekoBot.Modules.Music
return; return;
if (!musicPlayer.ToggleAutoplay()) if (!musicPlayer.ToggleAutoplay())
await imsg.Channel.SendMessageAsync("🎶`Autoplay disabled.`").ConfigureAwait(false); await channel.SendMessageAsync("🎶`Autoplay disabled.`").ConfigureAwait(false);
else else
await imsg.Channel.SendMessageAsync("🎶`Autoplay enabled.`").ConfigureAwait(false); await channel.SendMessageAsync("🎶`Autoplay enabled.`").ConfigureAwait(false);
}); });
}); });
} }

View File

@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Permissions.Commands
? e.Channel ? e.Channel
: PermissionHelper.ValidateChannel(e.Server, chanStr); : PermissionHelper.ValidateChannel(e.Server, chanStr);
await PermissionsHandler.SetChannelFilterInvitesPermission(chan, state).ConfigureAwait(false); await PermissionsHandler.SetChannelFilterInvitesPermission(chan, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for **{chan.Name}** channel.") await channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for **{chan.Name}** channel.")
.ConfigureAwait(false); .ConfigureAwait(false);
return; return;
} }
@ -82,13 +82,13 @@ namespace NadekoBot.Modules.Permissions.Commands
{ {
await PermissionsHandler.SetChannelFilterInvitesPermission(curChannel, state).ConfigureAwait(false); await PermissionsHandler.SetChannelFilterInvitesPermission(curChannel, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for **ALL** channels.") await channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for **ALL** channels.")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}") await channel.SendMessageAsync($"💢 Error: {ex.Message}")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
}); });
@ -103,13 +103,13 @@ namespace NadekoBot.Modules.Permissions.Commands
{ {
var state = PermissionHelper.ValidateBool(e.GetArg("bool")); var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
await PermissionsHandler.SetServerFilterInvitesPermission(e.Server, state).ConfigureAwait(false); await PermissionsHandler.SetServerFilterInvitesPermission(e.Server, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for this server.") await channel.SendMessageAsync($"Invite Filter has been **{(state ? "enabled" : "disabled")}** for this server.")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
} }

View File

@ -69,7 +69,7 @@ namespace NadekoBot.Modules.Permissions.Commands
? e.Channel ? e.Channel
: PermissionHelper.ValidateChannel(e.Server, chanStr); : PermissionHelper.ValidateChannel(e.Server, chanStr);
await PermissionsHandler.SetChannelWordPermission(chan, state).ConfigureAwait(false); await PermissionsHandler.SetChannelWordPermission(chan, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** for **{chan.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** for **{chan.Name}** channel.").ConfigureAwait(false);
return; return;
} }
//all channels //all channels
@ -78,11 +78,11 @@ namespace NadekoBot.Modules.Permissions.Commands
{ {
await PermissionsHandler.SetChannelWordPermission(curChannel, state).ConfigureAwait(false); await PermissionsHandler.SetChannelWordPermission(curChannel, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** for **ALL** channels.").ConfigureAwait(false); await channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** for **ALL** channels.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
@ -99,12 +99,12 @@ namespace NadekoBot.Modules.Permissions.Commands
if (string.IsNullOrWhiteSpace(word)) if (string.IsNullOrWhiteSpace(word))
return; return;
await PermissionsHandler.AddFilteredWord(e.Server, word.ToLowerInvariant().Trim()).ConfigureAwait(false); await PermissionsHandler.AddFilteredWord(e.Server, word.ToLowerInvariant().Trim()).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully added new filtered word.").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully added new filtered word.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
@ -121,12 +121,12 @@ namespace NadekoBot.Modules.Permissions.Commands
if (string.IsNullOrWhiteSpace(word)) if (string.IsNullOrWhiteSpace(word))
return; return;
await PermissionsHandler.RemoveFilteredWord(e.Server, word.ToLowerInvariant().Trim()).ConfigureAwait(false); await PermissionsHandler.RemoveFilteredWord(e.Server, word.ToLowerInvariant().Trim()).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Successfully removed filtered word.").ConfigureAwait(false); await channel.SendMessageAsync($"Successfully removed filtered word.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
@ -141,12 +141,12 @@ namespace NadekoBot.Modules.Permissions.Commands
Classes.ServerPermissions serverPerms; Classes.ServerPermissions serverPerms;
if (!PermissionsHandler.PermissionsDict.TryGetValue(e.Server.Id, out serverPerms)) if (!PermissionsHandler.PermissionsDict.TryGetValue(e.Server.Id, out serverPerms))
return; return;
await imsg.Channel.SendMessageAsync($"There are `{serverPerms.Words.Count}` filtered words.\n" + await channel.SendMessageAsync($"There are `{serverPerms.Words.Count}` filtered words.\n" +
string.Join("\n", serverPerms.Words)).ConfigureAwait(false); string.Join("\n", serverPerms.Words)).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
@ -160,13 +160,13 @@ namespace NadekoBot.Modules.Permissions.Commands
{ {
var state = PermissionHelper.ValidateBool(e.GetArg("bool")); var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
await PermissionsHandler.SetServerWordPermission(e.Server, state).ConfigureAwait(false); await PermissionsHandler.SetServerWordPermission(e.Server, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** on this server.") await channel.SendMessageAsync($"Word filtering has been **{(state ? "enabled" : "disabled")}** on this server.")
.ConfigureAwait(false); .ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢 Error: {ex.Message}").ConfigureAwait(false);
} }
}); });
} }

View File

@ -39,7 +39,7 @@ namespace NadekoBot.Modules.Permissions
{ {
if (string.IsNullOrWhiteSpace(e.GetArg("role"))) if (string.IsNullOrWhiteSpace(e.GetArg("role")))
{ {
await imsg.Channel.SendMessageAsync($"Current permissions role is `{PermissionsHandler.GetServerPermissionsRoleName(e.Server)}`").ConfigureAwait(false); await channel.SendMessageAsync($"Current permissions role is `{PermissionsHandler.GetServerPermissionsRoleName(e.Server)}`").ConfigureAwait(false);
return; return;
} }
@ -52,11 +52,11 @@ namespace NadekoBot.Modules.Permissions
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
await imsg.Channel.SendMessageAsync($"Role `{arg}` probably doesn't exist. Create the role with that name first.").ConfigureAwait(false); await channel.SendMessageAsync($"Role `{arg}` probably doesn't exist. Create the role with that name first.").ConfigureAwait(false);
return; return;
} }
await PermissionsHandler.SetPermissionsRole(e.Server, role.Name).ConfigureAwait(false); await PermissionsHandler.SetPermissionsRole(e.Server, role.Name).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false); await channel.SendMessageAsync($"Role `{role.Name}` is now required in order to change permissions.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "rolepermscopy") cgb.CreateCommand(Prefix + "rolepermscopy")
@ -71,7 +71,7 @@ namespace NadekoBot.Modules.Permissions
var args = arg.Split('~').Select(a => a.Trim()).ToArray(); var args = arg.Split('~').Select(a => a.Trim()).ToArray();
if (args.Length > 2) if (args.Length > 2)
{ {
await imsg.Channel.SendMessageAsync("💢Invalid number of '~'s in the argument.").ConfigureAwait(false); await channel.SendMessageAsync("💢Invalid number of '~'s in the argument.").ConfigureAwait(false);
return; return;
} }
try try
@ -80,11 +80,11 @@ namespace NadekoBot.Modules.Permissions
var toRole = PermissionHelper.ValidateRole(e.Server, args[1]); var toRole = PermissionHelper.ValidateRole(e.Server, args[1]);
await PermissionsHandler.CopyRolePermissions(fromRole, toRole).ConfigureAwait(false); await PermissionsHandler.CopyRolePermissions(fromRole, toRole).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Copied permission settings from **{fromRole.Name}** to **{toRole.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Copied permission settings from **{fromRole.Name}** to **{toRole.Name}**.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢{ex.Message}").ConfigureAwait(false); await channel.SendMessageAsync($"💢{ex.Message}").ConfigureAwait(false);
} }
}); });
cgb.CreateCommand(Prefix + "chnlpermscopy") cgb.CreateCommand(Prefix + "chnlpermscopy")
@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Permissions
var args = arg.Split('~').Select(a => a.Trim()).ToArray(); var args = arg.Split('~').Select(a => a.Trim()).ToArray();
if (args.Length > 2) if (args.Length > 2)
{ {
await imsg.Channel.SendMessageAsync("💢Invalid number of '~'s in the argument."); await channel.SendMessageAsync("💢Invalid number of '~'s in the argument.");
return; return;
} }
try try
@ -108,11 +108,11 @@ namespace NadekoBot.Modules.Permissions
var toChannel = PermissionHelper.ValidateChannel(e.Server, args[1]); var toChannel = PermissionHelper.ValidateChannel(e.Server, args[1]);
await PermissionsHandler.CopyChannelPermissions(fromChannel, toChannel).ConfigureAwait(false); await PermissionsHandler.CopyChannelPermissions(fromChannel, toChannel).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Copied permission settings from **{fromChannel.Name}** to **{toChannel.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Copied permission settings from **{fromChannel.Name}** to **{toChannel.Name}**.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢{ex.Message}"); await channel.SendMessageAsync($"💢{ex.Message}");
} }
}); });
cgb.CreateCommand(Prefix + "usrpermscopy") cgb.CreateCommand(Prefix + "usrpermscopy")
@ -127,7 +127,7 @@ namespace NadekoBot.Modules.Permissions
var args = arg.Split('~').Select(a => a.Trim()).ToArray(); var args = arg.Split('~').Select(a => a.Trim()).ToArray();
if (args.Length > 2) if (args.Length > 2)
{ {
await imsg.Channel.SendMessageAsync("💢Invalid number of '~'s in the argument.").ConfigureAwait(false); await channel.SendMessageAsync("💢Invalid number of '~'s in the argument.").ConfigureAwait(false);
return; return;
} }
try try
@ -136,11 +136,11 @@ namespace NadekoBot.Modules.Permissions
var toUser = PermissionHelper.ValidateUser(e.Server, args[1]); var toUser = PermissionHelper.ValidateUser(e.Server, args[1]);
await PermissionsHandler.CopyUserPermissions(fromUser, toUser).ConfigureAwait(false); await PermissionsHandler.CopyUserPermissions(fromUser, toUser).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Copied permission settings from **{fromUser.ToString()}**to * *{toUser.ToString()}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Copied permission settings from **{fromUser.ToString()}**to * *{toUser.ToString()}**.").ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync($"💢{ex.Message}"); await channel.SendMessageAsync($"💢{ex.Message}");
} }
}); });
@ -153,7 +153,7 @@ namespace NadekoBot.Modules.Permissions
var arg = e.GetArg("arg"); var arg = e.GetArg("arg");
var val = PermissionHelper.ValidateBool(arg); var val = PermissionHelper.ValidateBool(arg);
await PermissionsHandler.SetVerbosity(e.Server, val).ConfigureAwait(false); await PermissionsHandler.SetVerbosity(e.Server, val).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Verbosity set to {val}.").ConfigureAwait(false); await channel.SendMessageAsync($"Verbosity set to {val}.").ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "srvrperms") cgb.CreateCommand(Prefix + "srvrperms")
@ -163,8 +163,8 @@ namespace NadekoBot.Modules.Permissions
{ {
var perms = PermissionsHandler.GetServerPermissions(e.Server); var perms = PermissionsHandler.GetServerPermissions(e.Server);
if (string.IsNullOrWhiteSpace(perms?.ToString())) if (string.IsNullOrWhiteSpace(perms?.ToString()))
await imsg.Channel.SendMessageAsync("No permissions set for this server.").ConfigureAwait(false); await channel.SendMessageAsync("No permissions set for this server.").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "roleperms") cgb.CreateCommand(Prefix + "roleperms")
@ -182,15 +182,15 @@ namespace NadekoBot.Modules.Permissions
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false);
return; return;
} }
var perms = PermissionsHandler.GetRolePermissionsById(e.Server, role.Id); var perms = PermissionsHandler.GetRolePermissionsById(e.Server, role.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString())) if (string.IsNullOrWhiteSpace(perms?.ToString()))
await imsg.Channel.SendMessageAsync($"No permissions set for **{role.Name}** role.").ConfigureAwait(false); await channel.SendMessageAsync($"No permissions set for **{role.Name}** role.").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "chnlperms") cgb.CreateCommand(Prefix + "chnlperms")
@ -208,14 +208,14 @@ namespace NadekoBot.Modules.Permissions
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false);
return; return;
} }
var perms = PermissionsHandler.GetChannelPermissionsById(e.Server, channel.Id); var perms = PermissionsHandler.GetChannelPermissionsById(e.Server, channel.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString())) if (string.IsNullOrWhiteSpace(perms?.ToString()))
await imsg.Channel.SendMessageAsync($"No permissions set for **{channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"No permissions set for **{channel.Name}** channel.").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "userperms") cgb.CreateCommand(Prefix + "userperms")
@ -232,14 +232,14 @@ namespace NadekoBot.Modules.Permissions
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("💢 Error: " + ex.Message).ConfigureAwait(false);
return; return;
} }
var perms = PermissionsHandler.GetUserPermissionsById(e.Server, user.Id); var perms = PermissionsHandler.GetUserPermissionsById(e.Server, user.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString())) if (string.IsNullOrWhiteSpace(perms?.ToString()))
await imsg.Channel.SendMessageAsync($"No permissions set for user **{user.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"No permissions set for user **{user.Name}**.").ConfigureAwait(false);
await imsg.Channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false); await channel.SendMessageAsync(perms.ToString()).ConfigureAwait(false);
}); });
cgb.CreateCommand(Prefix + "srvrmdl") cgb.CreateCommand(Prefix + "srvrmdl")
@ -255,15 +255,15 @@ namespace NadekoBot.Modules.Permissions
var state = PermissionHelper.ValidateBool(e.GetArg("bool")); var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
await PermissionsHandler.SetServerModulePermission(e.Server, module, state).ConfigureAwait(false); await PermissionsHandler.SetServerModulePermission(e.Server, module, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -279,15 +279,15 @@ namespace NadekoBot.Modules.Permissions
var state = PermissionHelper.ValidateBool(e.GetArg("bool")); var state = PermissionHelper.ValidateBool(e.GetArg("bool"));
await PermissionsHandler.SetServerCommandPermission(e.Server, command, state).ConfigureAwait(false); await PermissionsHandler.SetServerCommandPermission(e.Server, command, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -309,23 +309,23 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetRoleModulePermission(role, module, state).ConfigureAwait(false); await PermissionsHandler.SetRoleModulePermission(role, module, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.").ConfigureAwait(false);
} }
else else
{ {
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role")); var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
await PermissionsHandler.SetRoleModulePermission(role, module, state).ConfigureAwait(false); await PermissionsHandler.SetRoleModulePermission(role, module, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false);
} }
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -347,23 +347,23 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetRoleCommandPermission(role, command, state).ConfigureAwait(false); await PermissionsHandler.SetRoleCommandPermission(role, command, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.").ConfigureAwait(false);
} }
else else
{ {
var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role")); var role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
await PermissionsHandler.SetRoleCommandPermission(role, command, state).ConfigureAwait(false); await PermissionsHandler.SetRoleCommandPermission(role, command, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false);
} }
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -385,28 +385,28 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetChannelModulePermission(channel, module, state).ConfigureAwait(false); await PermissionsHandler.SetChannelModulePermission(channel, module, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.").ConfigureAwait(false);
} }
else if (string.IsNullOrWhiteSpace(channelArg)) else if (string.IsNullOrWhiteSpace(channelArg))
{ {
await PermissionsHandler.SetChannelModulePermission(e.Channel, module, state).ConfigureAwait(false); await PermissionsHandler.SetChannelModulePermission(e.Channel, module, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{e.Channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{e.Channel.Name}** channel.").ConfigureAwait(false);
} }
else else
{ {
var channel = PermissionHelper.ValidateChannel(e.Server, channelArg); var channel = PermissionHelper.ValidateChannel(e.Server, channelArg);
await PermissionsHandler.SetChannelModulePermission(channel, module, state).ConfigureAwait(false); await PermissionsHandler.SetChannelModulePermission(channel, module, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false);
} }
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -428,23 +428,23 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetChannelCommandPermission(channel, command, state).ConfigureAwait(false); await PermissionsHandler.SetChannelCommandPermission(channel, command, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.").ConfigureAwait(false);
} }
else else
{ {
var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel")); var channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
await PermissionsHandler.SetChannelCommandPermission(channel, command, state).ConfigureAwait(false); await PermissionsHandler.SetChannelCommandPermission(channel, command, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false);
} }
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -462,15 +462,15 @@ namespace NadekoBot.Modules.Permissions
var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user")); var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
await PermissionsHandler.SetUserModulePermission(user, module, state).ConfigureAwait(false); await PermissionsHandler.SetUserModulePermission(user, module, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -488,15 +488,15 @@ namespace NadekoBot.Modules.Permissions
var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user")); var user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
await PermissionsHandler.SetUserCommandPermission(user, command, state).ConfigureAwait(false); await PermissionsHandler.SetUserCommandPermission(user, command, state).ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -513,15 +513,15 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetServerModulePermission(e.Server, module.Name, state).ConfigureAwait(false); await PermissionsHandler.SetServerModulePermission(e.Server, module.Name, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false); await channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -540,15 +540,15 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetServerCommandPermission(e.Server, command.Text, state).ConfigureAwait(false); await PermissionsHandler.SetServerCommandPermission(e.Server, command.Text, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false); await channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** on this server.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -568,15 +568,15 @@ namespace NadekoBot.Modules.Permissions
await PermissionsHandler.SetChannelModulePermission(channel, module.Name, state).ConfigureAwait(false); await PermissionsHandler.SetChannelModulePermission(channel, module.Name, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -596,15 +596,15 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetChannelCommandPermission(channel, command.Text, state).ConfigureAwait(false); await PermissionsHandler.SetChannelCommandPermission(channel, command.Text, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false); await channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -623,15 +623,15 @@ namespace NadekoBot.Modules.Permissions
await PermissionsHandler.SetRoleModulePermission(role, module.Name, state).ConfigureAwait(false); await PermissionsHandler.SetRoleModulePermission(role, module.Name, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false); await channel.SendMessageAsync($"All modules have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -655,7 +655,7 @@ namespace NadekoBot.Modules.Permissions
await PermissionsHandler.SetRoleCommandPermission(role, command.Text, state).ConfigureAwait(false); await PermissionsHandler.SetRoleCommandPermission(role, command.Text, state).ConfigureAwait(false);
} }
} }
await imsg.Channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **all roles** role.").ConfigureAwait(false); await channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **all roles** role.").ConfigureAwait(false);
} }
else else
{ {
@ -665,16 +665,16 @@ namespace NadekoBot.Modules.Permissions
{ {
await PermissionsHandler.SetRoleCommandPermission(role, command.Text, state).ConfigureAwait(false); await PermissionsHandler.SetRoleCommandPermission(role, command.Text, state).ConfigureAwait(false);
} }
await imsg.Channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false); await channel.SendMessageAsync($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.").ConfigureAwait(false);
} }
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -690,7 +690,7 @@ namespace NadekoBot.Modules.Permissions
var usr = e.Message.MentionedUsers.First(); var usr = e.Message.MentionedUsers.First();
NadekoBot.Config.UserBlacklist.Add(usr.Id); NadekoBot.Config.UserBlacklist.Add(usr.Id);
await ConfigHandler.SaveConfig().ConfigureAwait(false); await ConfigHandler.SaveConfig().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"`Sucessfully blacklisted user {usr.Name}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Sucessfully blacklisted user {usr.Name}`").ConfigureAwait(false);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
@ -708,11 +708,11 @@ namespace NadekoBot.Modules.Permissions
{ {
NadekoBot.Config.UserBlacklist.Remove(usr.Id); NadekoBot.Config.UserBlacklist.Remove(usr.Id);
await ConfigHandler.SaveConfig().ConfigureAwait(false); await ConfigHandler.SaveConfig().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"`Sucessfully unblacklisted user {usr.Name}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Sucessfully unblacklisted user {usr.Name}`").ConfigureAwait(false);
} }
else else
{ {
await imsg.Channel.SendMessageAsync($"`{usr.Name} was not in blacklist`").ConfigureAwait(false); await channel.SendMessageAsync($"`{usr.Name} was not in blacklist`").ConfigureAwait(false);
} }
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
@ -728,7 +728,7 @@ namespace NadekoBot.Modules.Permissions
var ch = e.Message.MentionedChannels.First(); var ch = e.Message.MentionedChannels.First();
NadekoBot.Config.UserBlacklist.Add(ch.Id); NadekoBot.Config.UserBlacklist.Add(ch.Id);
await ConfigHandler.SaveConfig().ConfigureAwait(false); await ConfigHandler.SaveConfig().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"`Sucessfully blacklisted channel {ch.Name}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Sucessfully blacklisted channel {ch.Name}`").ConfigureAwait(false);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
@ -743,7 +743,7 @@ namespace NadekoBot.Modules.Permissions
var ch = e.Message.MentionedChannels.First(); var ch = e.Message.MentionedChannels.First();
NadekoBot.Config.UserBlacklist.Remove(ch.Id); NadekoBot.Config.UserBlacklist.Remove(ch.Id);
await ConfigHandler.SaveConfig().ConfigureAwait(false); await ConfigHandler.SaveConfig().ConfigureAwait(false);
await imsg.Channel.SendMessageAsync($"`Sucessfully blacklisted channel {ch.Name}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Sucessfully blacklisted channel {ch.Name}`").ConfigureAwait(false);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
@ -762,7 +762,7 @@ namespace NadekoBot.Modules.Permissions
NadekoBot.Client.FindServers(arg.Trim()).FirstOrDefault(); NadekoBot.Client.FindServers(arg.Trim()).FirstOrDefault();
if (server == null) if (server == null)
{ {
await imsg.Channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false); await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
return; return;
} }
var serverId = server.Id; var serverId = server.Id;
@ -774,7 +774,7 @@ namespace NadekoBot.Modules.Permissions
TypingGame typeracer; TypingGame typeracer;
SpeedTyping.RunningContests.TryRemove(serverId, out typeracer); SpeedTyping.RunningContests.TryRemove(serverId, out typeracer);
await imsg.Channel.SendMessageAsync($"`Sucessfully blacklisted server {server.Name}`").ConfigureAwait(false); await channel.SendMessageAsync($"`Sucessfully blacklisted server {server.Name}`").ConfigureAwait(false);
}).ConfigureAwait(false); }).ConfigureAwait(false);
}); });
@ -797,17 +797,17 @@ namespace NadekoBot.Modules.Permissions
await PermissionsHandler.SetCommandCooldown(e.Server, command, secs).ConfigureAwait(false); await PermissionsHandler.SetCommandCooldown(e.Server, command, secs).ConfigureAwait(false);
if(secs == 0) if(secs == 0)
await imsg.Channel.SendMessageAsync($"Command **{command}** has no coooldown now.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** has no coooldown now.").ConfigureAwait(false);
else else
await imsg.Channel.SendMessageAsync($"Command **{command}** now has a **{secs} {(secs==1 ? "second" : "seconds")}** cooldown.").ConfigureAwait(false); await channel.SendMessageAsync($"Command **{command}** now has a **{secs} {(secs==1 ? "second" : "seconds")}** cooldown.").ConfigureAwait(false);
} }
catch (ArgumentException exArg) catch (ArgumentException exArg)
{ {
await imsg.Channel.SendMessageAsync(exArg.Message).ConfigureAwait(false); await channel.SendMessageAsync(exArg.Message).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
await imsg.Channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false); await channel.SendMessageAsync("Something went terribly wrong - " + ex.Message).ConfigureAwait(false);
} }
}); });
@ -823,10 +823,10 @@ namespace NadekoBot.Modules.Permissions
if (!perms.CommandCooldowns.Any()) if (!perms.CommandCooldowns.Any())
{ {
await imsg.Channel.SendMessageAsync("`No command cooldowns set.`").ConfigureAwait(false); await channel.SendMessageAsync("`No command cooldowns set.`").ConfigureAwait(false);
return; return;
} }
await imsg.Channel.SendMessageAsync(SearchHelper.ShowInPrettyCode(perms.CommandCooldowns.Select(c=>c.Key+ ": "+c.Value+" secs"),s=>$"{s,-30}",2)).ConfigureAwait(false); await channel.SendMessageAsync(SearchHelper.ShowInPrettyCode(perms.CommandCooldowns.Select(c=>c.Key+ ": "+c.Value+" secs"),s=>$"{s,-30}",2)).ConfigureAwait(false);
}); });
}); });
} }