Animal racing done, more mass replacements
This commit is contained in:
		| @@ -23,7 +23,7 @@ namespace NadekoBot.Classes | ||||
|  | ||||
|             var flows = amount + " " + NadekoBot.Config.CurrencySign; | ||||
|  | ||||
|             await u.SendMessage("👑Congratulations!👑\nYou received: " + flows).ConfigureAwait(false); | ||||
|             await u.SendMessageAsync("👑Congratulations!👑\nYou received: " + flows).ConfigureAwait(false); | ||||
|         } | ||||
|  | ||||
|         public static async Task<bool> RemoveFlowers(Discord.User u, string reason, int amount, bool silent=false, string message="👎`Bot owner has taken {0}{1} from you.`") | ||||
| @@ -46,7 +46,7 @@ namespace NadekoBot.Classes | ||||
|             if (silent) | ||||
|                 return true; | ||||
|  | ||||
|             await u.SendMessage(string.Format(message,amount,NadekoBot.Config.CurrencySign)).ConfigureAwait(false); | ||||
|             await u.SendMessageAsync(string.Format(message,amount,NadekoBot.Config.CurrencySign)).ConfigureAwait(false); | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -543,7 +543,7 @@ namespace NadekoBot.Modules.Administration | ||||
|         //        { | ||||
|         //            return; | ||||
|         //        } | ||||
|         //        await channel.SendMessage(msg); | ||||
|         //        await channel.SendMessageAsync(msg); | ||||
|         //    } | ||||
|         //    else if (ids[1].ToUpperInvariant().StartsWith("U:")) | ||||
|         //    { | ||||
| @@ -553,7 +553,7 @@ namespace NadekoBot.Modules.Administration | ||||
|         //        { | ||||
|         //            return; | ||||
|         //        } | ||||
|         //        await user.SendMessage(msg); | ||||
|         //        await user.SendMessageAsync(msg); | ||||
|         //    } | ||||
|         //    else | ||||
|         //    { | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
| //                            continue; | ||||
| //                        foreach (var chan in set.Except(new[] { e.Channel })) | ||||
| //                        { | ||||
| //                            await chan.SendMessage(GetText(e.Server, e.Channel, imsg.Author, e.Message)).ConfigureAwait(false); | ||||
| //                            await chan.SendMessageAsync(GetText(e.Server, e.Channel, imsg.Author, e.Message)).ConfigureAwait(false); | ||||
| //                        } | ||||
| //                    } | ||||
| //                } | ||||
| @@ -75,7 +75,7 @@ | ||||
| //                    if (Subscribers.TryAdd(token, set)) | ||||
| //                    { | ||||
| //                        set.Add(e.Channel); | ||||
| //                        await imsg.Author.SendMessage("This is your CSC token:" + token.ToString()).ConfigureAwait(false); | ||||
| //                        await imsg.Author.SendMessageAsync("This is your CSC token:" + token.ToString()).ConfigureAwait(false); | ||||
| //                    } | ||||
| //                }); | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
| //                    var incs = DbHandler.Instance.FindAll<Incident>(i => i.ServerId == sid && i.Read == false); | ||||
| //                    DbHandler.Instance.Connection.UpdateAll(incs.Select(i => { i.Read = true; return i; })); | ||||
|  | ||||
| //                    await imsg.Author.SendMessage(string.Join("\n----------------------", incs.Select(i => i.Text))); | ||||
| //                    await imsg.Author.SendMessageAsync(string.Join("\n----------------------", incs.Select(i => i.Text))); | ||||
| //                }); | ||||
|  | ||||
| //            cgb.CreateCommand(Module.Prefix + "listallincidents") | ||||
|   | ||||
| @@ -45,7 +45,7 @@ | ||||
| //                    if (usr?.Status != UserStatus.Offline) | ||||
| //                        return; | ||||
| //                    await channel.SendMessageAsync($"User `{usr.Name}` is offline. PM sent.").ConfigureAwait(false); | ||||
| //                    await usr.SendMessage( | ||||
| //                    await usr.SendMessageAsync( | ||||
| //                        $"User `{imsg.Author.Username}` mentioned you on " + | ||||
| //                        $"`{e.Server.Name}` server while you were offline.\n" + | ||||
| //                        $"`Message:` {e.Message.Text}").ConfigureAwait(false); | ||||
| @@ -76,7 +76,7 @@ | ||||
| //                     //send merged messages to each channel | ||||
| //                     foreach (var k in toSend) | ||||
| //                     { | ||||
| //                         try { await k.Key.SendMessage(Environment.NewLine + k.Value).ConfigureAwait(false); } catch { } | ||||
| //                         try { await k.Key.SendMessageAsync(Environment.NewLine + k.Value).ConfigureAwait(false); } catch { } | ||||
| //                     } | ||||
|  | ||||
| //                     await Task.Delay(5000); | ||||
| @@ -96,10 +96,10 @@ | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                if (e.Before.Name != e.After.Name) | ||||
| //                    await ch.SendMessage($@"`{prettyCurrentTime}` **Channel Name Changed** `#{e.Before.Name}` (*{e.After.Id}*) | ||||
| //                    await ch.SendMessageAsync($@"`{prettyCurrentTime}` **Channel Name Changed** `#{e.Before.Name}` (*{e.After.Id}*) | ||||
| //        `New:` {e.After.Name}").ConfigureAwait(false); | ||||
| //                else if (e.Before.Topic != e.After.Topic) | ||||
| //                    await ch.SendMessage($@"`{prettyCurrentTime}` **Channel Topic Changed** `#{e.After.Name}` (*{e.After.Id}*) | ||||
| //                    await ch.SendMessageAsync($@"`{prettyCurrentTime}` **Channel Topic Changed** `#{e.After.Name}` (*{e.After.Id}*) | ||||
| //        `Old:` {e.Before.Topic} | ||||
| //        `New:` {e.After.Topic}").ConfigureAwait(false); | ||||
| //            } | ||||
| @@ -117,7 +117,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"❗`{prettyCurrentTime}`❗`Channel Deleted:` #{e.Channel.Name} (*{e.Channel.Id}*)").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"❗`{prettyCurrentTime}`❗`Channel Deleted:` #{e.Channel.Name} (*{e.Channel.Id}*)").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -133,7 +133,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"`{prettyCurrentTime}`🆕`Channel Created:` #{e.Channel.Mention} (*{e.Channel.Id}*)").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`🆕`Channel Created:` #{e.Channel.Mention} (*{e.Channel.Id}*)").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -148,7 +148,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"`{prettyCurrentTime}`♻`User was unbanned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`♻`User was unbanned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -163,7 +163,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"`{prettyCurrentTime}`✅`User joined:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`✅`User joined:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -178,7 +178,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"`{prettyCurrentTime}`❗`User left:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"`{prettyCurrentTime}`❗`User left:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -193,7 +193,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage($"❗`{prettyCurrentTime}`❌`User banned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync($"❗`{prettyCurrentTime}`❌`User banned:` **{imsg.Author.Username}** ({imsg.Author.Id})").ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
| @@ -213,13 +213,13 @@ | ||||
| //                    return; | ||||
| //                if (!string.IsNullOrWhiteSpace(e.Message.Text)) | ||||
| //                { | ||||
| //                    await ch.SendMessage( | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //                } | ||||
| //                else | ||||
| //                { | ||||
| //                    await ch.SendMessage( | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **File Uploaded** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //                } | ||||
| @@ -242,13 +242,13 @@ | ||||
| //                    return; | ||||
| //                if (!string.IsNullOrWhiteSpace(e.Message.Text)) | ||||
| //                { | ||||
| //                    await ch.SendMessage( | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false); | ||||
| //                } | ||||
| //                else | ||||
| //                { | ||||
| //                    await ch.SendMessage( | ||||
| //                    await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **File Deleted** `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false); | ||||
| //                } | ||||
| @@ -268,7 +268,7 @@ | ||||
| //                Channel ch; | ||||
| //                if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null) | ||||
| //                    return; | ||||
| //                await ch.SendMessage( | ||||
| //                await ch.SendMessageAsync( | ||||
| //        $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}` | ||||
| //👤`{imsg.Author?.ToString() ?? ("NULL")}` | ||||
| //        `Old:` {e.Before.Text.Unmention()} | ||||
| @@ -318,15 +318,15 @@ | ||||
| //                    } | ||||
| //                    if ((notifyLeave && notifyJoin) && (notifyChAfter == notifyChBefore)) | ||||
| //                    { | ||||
| //                        await notifyChAfter.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} moved from **{beforeVch.Mention}** to **{afterVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                        await notifyChAfter.SendMessageAsync($"🎼`{prettyCurrentTime}` {e.Before.Name} moved from **{beforeVch.Mention}** to **{afterVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                    } | ||||
| //                    else if (notifyJoin) | ||||
| //                    { | ||||
| //                        await notifyChAfter.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} has joined **{afterVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                        await notifyChAfter.SendMessageAsync($"🎼`{prettyCurrentTime}` {e.Before.Name} has joined **{afterVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                    } | ||||
| //                    else if (notifyLeave) | ||||
| //                    { | ||||
| //                        await notifyChBefore.SendMessage($"🎼`{prettyCurrentTime}` {e.Before.Name} has left **{beforeVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                        await notifyChBefore.SendMessageAsync($"🎼`{prettyCurrentTime}` {e.Before.Name} has left **{beforeVch.Mention}** voice channel.").ConfigureAwait(false); | ||||
| //                    } | ||||
| //                } | ||||
| //            } | ||||
| @@ -368,7 +368,7 @@ | ||||
| //                } | ||||
| //                else | ||||
| //                    return; | ||||
| //                await ch.SendMessage(str).ConfigureAwait(false); | ||||
| //                await ch.SendMessageAsync(str).ConfigureAwait(false); | ||||
| //            } | ||||
| //            catch { } | ||||
| //        } | ||||
|   | ||||
| @@ -47,7 +47,7 @@ | ||||
| //                    catch { } | ||||
| //                    try | ||||
| //                    { | ||||
| //                        lastMessage = await ch.SendMessage(msg).ConfigureAwait(false); | ||||
| //                        lastMessage = await ch.SendMessageAsync(msg).ConfigureAwait(false); | ||||
| //                    } | ||||
| //                    catch { } | ||||
| //                } | ||||
|   | ||||
| @@ -48,7 +48,7 @@ | ||||
| //                    Greeted++; | ||||
| //                    try | ||||
| //                    { | ||||
| //                        await imsg.Author.SendMessage($"`Farewell Message From {e.Server?.Name}`\n" + msg).ConfigureAwait(false); | ||||
| //                        await imsg.Author.SendMessageAsync($"`Farewell Message From {e.Server?.Name}`\n" + msg).ConfigureAwait(false); | ||||
|  | ||||
| //                    } | ||||
| //                    catch { } | ||||
| @@ -57,7 +57,7 @@ | ||||
| //                { | ||||
| //                    if (channel == null) return; | ||||
| //                    Greeted++; | ||||
| //                    var toDelete = await channel.SendMessage(msg).ConfigureAwait(false); | ||||
| //                    var toDelete = await channel.SendMessageAsync(msg).ConfigureAwait(false); | ||||
| //                    if (e.Server.CurrentUser.GetPermissions(channel).ManageMessages && controls.DeleteGreetMessages) | ||||
| //                    { | ||||
| //                        await Task.Delay(30000).ConfigureAwait(false); // 5 minutes | ||||
| @@ -84,13 +84,13 @@ | ||||
| //                if (controls.GreetPM) | ||||
| //                { | ||||
| //                    Greeted++; | ||||
| //                    await imsg.Author.SendMessage($"`Welcome Message From {e.Server.Name}`\n" + msg).ConfigureAwait(false); | ||||
| //                    await imsg.Author.SendMessageAsync($"`Welcome Message From {e.Server.Name}`\n" + msg).ConfigureAwait(false); | ||||
| //                } | ||||
| //                else | ||||
| //                { | ||||
| //                    if (channel == null) return; | ||||
| //                    Greeted++; | ||||
| //                    var toDelete = await channel.SendMessage(msg).ConfigureAwait(false); | ||||
| //                    var toDelete = await channel.SendMessageAsync(msg).ConfigureAwait(false); | ||||
| //                    if (e.Server.CurrentUser.GetPermissions(channel).ManageMessages && controls.DeleteGreetMessages) | ||||
| //                    { | ||||
| //                        await Task.Delay(30000).ConfigureAwait(false); // 5 minutes | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
|  | ||||
| //                        try | ||||
| //                        { | ||||
| //                            await e.Server.Owner.SendMessage( | ||||
| //                            await e.Server.Owner.SendMessageAsync( | ||||
| //                                "I don't have manage server and/or Manage Channels permission," + | ||||
| //                                $" so I cannot run voice+text on **{e.Server.Name}** server.").ConfigureAwait(false); | ||||
| //                        } | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| using Discord; | ||||
| using Discord.Commands; | ||||
| using NadekoBot.Attributes; | ||||
| using NadekoBot.Classes; | ||||
| using NadekoBot.Extensions; | ||||
| using System; | ||||
| @@ -11,286 +12,283 @@ using System.Threading.Tasks; | ||||
|  | ||||
| namespace NadekoBot.Modules.Gambling.Commands | ||||
| { | ||||
|     [Group] | ||||
|     class AnimalRacing | ||||
|     public partial class Gambling | ||||
|     { | ||||
|         public static ConcurrentDictionary<ulong, AnimalRace> AnimalRaces = new ConcurrentDictionary<ulong, AnimalRace>(); | ||||
|  | ||||
|         public AnimalRacing(DiscordModule module) : base(module) | ||||
|         [Group] | ||||
|         public class AnimalRacing | ||||
|         { | ||||
|         } | ||||
|             public static ConcurrentDictionary<ulong, AnimalRace> AnimalRaces = new ConcurrentDictionary<ulong, AnimalRace>(); | ||||
|  | ||||
|         internal override void Init(CommandGroupBuilder cgb) | ||||
|         { | ||||
|             cgb.CreateCommand(Prefix + "race") | ||||
|                 .Description($"Starts a new animal race. | `{Prefix}race`") | ||||
|                 .Do(e => | ||||
|                 { | ||||
|                     var ar = new AnimalRace(e.Server.Id, e.Channel); | ||||
|                     if (ar.Fail) | ||||
|                     { | ||||
|                         return; | ||||
|                     } | ||||
|                 }); | ||||
|  | ||||
|  | ||||
|             cgb.CreateCommand(Prefix + "joinrace") | ||||
|                 .Alias(Prefix + "jr") | ||||
|                 .Description($"Joins a new race. You can specify an amount of flowers for betting (optional). You will get YourBet*(participants-1) back if you win. | `{Prefix}jr` or `{Prefix}jr 5`") | ||||
|                 .Parameter("amount", ParameterType.Optional) | ||||
|                 .Do(async e => | ||||
|                 { | ||||
|  | ||||
|                     int amount; | ||||
|                     if (!int.TryParse(e.GetArg("amount"), out amount) || amount < 0) | ||||
|                         amount = 0; | ||||
|  | ||||
|                     var userFlowers = Gambling.GetUserFlowers(imsg.Author.Id); | ||||
|  | ||||
|                     if (userFlowers < amount) | ||||
|                     { | ||||
|                         await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|                         return; | ||||
|                     } | ||||
|  | ||||
|                     if (amount > 0) | ||||
|                         await FlowersHandler.RemoveFlowers(imsg.Author, "BetRace", (int)amount, true).ConfigureAwait(false); | ||||
|  | ||||
|                     AnimalRace ar; | ||||
|                     if (!AnimalRaces.TryGetValue(e.Server.Id, out ar)) | ||||
|                     { | ||||
|                         await channel.SendMessageAsync("No race exists on this server"); | ||||
|                         return; | ||||
|                     } | ||||
|                     await ar.JoinRace(imsg.Author, amount); | ||||
|  | ||||
|                 }); | ||||
|         } | ||||
|  | ||||
|         public class AnimalRace | ||||
|         { | ||||
|  | ||||
|             private ConcurrentQueue<string> animals = new ConcurrentQueue<string>(NadekoBot.Config.RaceAnimals.Shuffle()); | ||||
|  | ||||
|             public bool Fail { get; internal set; } | ||||
|  | ||||
|             public List<Participant> participants = new List<Participant>(); | ||||
|             private ulong serverId; | ||||
|             private int messagesSinceGameStarted = 0; | ||||
|  | ||||
|             public IGuildChannel raceChannel { get; set; } | ||||
|             public bool Started { get; private set; } = false; | ||||
|  | ||||
|             public AnimalRace(ulong serverId, Channel ch) | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task Race(IMessage imsg) | ||||
|             { | ||||
|                 this.serverId = serverId; | ||||
|                 this.raceChannel = ch; | ||||
|                 if (!AnimalRaces.TryAdd(serverId, this)) | ||||
|                 var channel = imsg.Channel as ITextChannel; | ||||
|  | ||||
|                 var ar = new AnimalRace(channel.Guild.Id, channel); | ||||
|  | ||||
|                 if (ar.Fail) | ||||
|                     await channel.SendMessageAsync("🏁 `Failed starting a race. Another race is probably running.`"); | ||||
|             } | ||||
|  | ||||
|             [LocalizedCommand, LocalizedDescription, LocalizedSummary] | ||||
|             [RequireContext(ContextType.Guild)] | ||||
|             public async Task JoinRace(IMessage imsg, int amount = 0) | ||||
|             { | ||||
|                 var channel = imsg.Channel as ITextChannel; | ||||
|  | ||||
|                 if (amount < 0) | ||||
|                     amount = 0; | ||||
|  | ||||
|                 //todo DB | ||||
|                 //var userFlowers = Gambling.GetUserFlowers(imsg.Author.Id); | ||||
|  | ||||
|                 //if (userFlowers < amount) | ||||
|                 //{ | ||||
|                 //    await channel.SendMessageAsync($"{imsg.Author.Mention} You don't have enough {NadekoBot.Config.CurrencyName}s. You only have {userFlowers}{NadekoBot.Config.CurrencySign}.").ConfigureAwait(false); | ||||
|                 //    return; | ||||
|                 //} | ||||
|  | ||||
|                 //if (amount > 0) | ||||
|                 //    await FlowersHandler.RemoveFlowers(imsg.Author, "BetRace", (int)amount, true).ConfigureAwait(false); | ||||
|  | ||||
|                 AnimalRace ar; | ||||
|                 if (!AnimalRaces.TryGetValue(channel.Guild.Id, out ar)) | ||||
|                 { | ||||
|                     Fail = true; | ||||
|                     await channel.SendMessageAsync("No race exists on this server"); | ||||
|                     return; | ||||
|                 } | ||||
|                 var cancelSource = new CancellationTokenSource(); | ||||
|                 var token = cancelSource.Token; | ||||
|                 var fullgame = CheckForFullGameAsync(token); | ||||
|                 Task.Run(async () => | ||||
|                 await ar.JoinRace(imsg.Author as IGuildUser, amount); | ||||
|             } | ||||
|  | ||||
|             public class AnimalRace | ||||
|             { | ||||
|  | ||||
|                 private ConcurrentQueue<string> animals = new ConcurrentQueue<string>(NadekoBot.Config.RaceAnimals.Shuffle()); | ||||
|  | ||||
|                 public bool Fail { get; internal set; } | ||||
|  | ||||
|                 public List<Participant> participants = new List<Participant>(); | ||||
|                 private ulong serverId; | ||||
|                 private int messagesSinceGameStarted = 0; | ||||
|  | ||||
|                 public ITextChannel raceChannel { get; set; } | ||||
|                 public bool Started { get; private set; } = false; | ||||
|  | ||||
|                 public AnimalRace(ulong serverId, ITextChannel ch) | ||||
|                 { | ||||
|                     this.serverId = serverId; | ||||
|                     this.raceChannel = ch; | ||||
|                     if (!AnimalRaces.TryAdd(serverId, this)) | ||||
|                     { | ||||
|                         Fail = true; | ||||
|                         return; | ||||
|                     } | ||||
|                     var cancelSource = new CancellationTokenSource(); | ||||
|                     var token = cancelSource.Token; | ||||
|                     var fullgame = CheckForFullGameAsync(token); | ||||
|                     Task.Run(async () => | ||||
|                     { | ||||
|                         try | ||||
|                         { | ||||
|                             //todo Commmand prefixes from config | ||||
|                             await raceChannel.SendMessageAsync($"🏁`Race is starting in 20 seconds or when the room is full. Type $jr to join the race.`"); | ||||
|                             var t = await Task.WhenAny(Task.Delay(20000, token), fullgame); | ||||
|                             Started = true; | ||||
|                             cancelSource.Cancel(); | ||||
|                             if (t == fullgame) | ||||
|                             { | ||||
|                                 await raceChannel.SendMessageAsync("🏁`Race full, starting right now!`"); | ||||
|                             } | ||||
|                             else if (participants.Count > 1) | ||||
|                             { | ||||
|                                 await raceChannel.SendMessageAsync("🏁`Game starting with " + participants.Count + " participants.`"); | ||||
|                             } | ||||
|                             else | ||||
|                             { | ||||
|                                 await raceChannel.SendMessageAsync("🏁`Race failed to start since there was not enough participants.`"); | ||||
|                                 var p = participants.FirstOrDefault(); | ||||
|                                 //todo DB | ||||
|                                 //if (p != null) | ||||
|                                 //    await FlowersHandler.AddFlowersAsync(p.User, "BetRace", p.AmountBet, true).ConfigureAwait(false); | ||||
|                                 End(); | ||||
|                                 return; | ||||
|                             } | ||||
|                             await Task.Run(StartRace); | ||||
|                             End(); | ||||
|                         } | ||||
|                         catch { } | ||||
|                     }); | ||||
|                 } | ||||
|  | ||||
|                 private void End() | ||||
|                 { | ||||
|                     AnimalRace throwaway; | ||||
|                     AnimalRaces.TryRemove(serverId, out throwaway); | ||||
|                 } | ||||
|  | ||||
|                 private async Task StartRace() | ||||
|                 { | ||||
|                     var rng = new Random(); | ||||
|                     Participant winner = null; | ||||
|                     IMessage msg = null; | ||||
|                     int place = 1; | ||||
|                     try | ||||
|                     { | ||||
|                         await raceChannel.SendMessage($"🏁`Race is starting in 20 seconds or when the room is full. Type {NadekoBot.Config.CommandPrefixes.Gambling}jr to join the race.`"); | ||||
|                         var t = await Task.WhenAny(Task.Delay(20000, token), fullgame); | ||||
|                         Started = true; | ||||
|                         cancelSource.Cancel(); | ||||
|                         if (t == fullgame) | ||||
|                         { | ||||
|                             await raceChannel.SendMessage("🏁`Race full, starting right now!`"); | ||||
|                         } | ||||
|                         else if (participants.Count > 1) | ||||
|                         { | ||||
|                             await raceChannel.SendMessage("🏁`Game starting with " + participants.Count + " participants.`"); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             await raceChannel.SendMessage("🏁`Race failed to start since there was not enough participants.`"); | ||||
|                             var p = participants.FirstOrDefault(); | ||||
|                             if (p != null) | ||||
|                                 await FlowersHandler.AddFlowersAsync(p.User, "BetRace", p.AmountBet, true).ConfigureAwait(false); | ||||
|                             End(); | ||||
|                             return; | ||||
|                         } | ||||
|                         await Task.Run(StartRace); | ||||
|                         End(); | ||||
|                     } | ||||
|                     catch { } | ||||
|                 }); | ||||
|             } | ||||
|                         NadekoBot.Client.MessageReceived += Client_MessageReceived; | ||||
|  | ||||
|             private void End() | ||||
|             { | ||||
|                 AnimalRace throwaway; | ||||
|                 AnimalRaces.TryRemove(serverId, out throwaway); | ||||
|             } | ||||
|  | ||||
|             private async Task StartRace() | ||||
|             { | ||||
|                 var rng = new Random(); | ||||
|                 Participant winner = null; | ||||
|                 IMessage msg = null; | ||||
|                 int place = 1; | ||||
|                 try | ||||
|                 { | ||||
|                     NadekoBot.Client.MessageReceived += Client_MessageReceived; | ||||
|  | ||||
|                     while (!participants.All(p => p.Total >= 60)) | ||||
|                     { | ||||
|                         //update the state | ||||
|                         participants.ForEach(p => | ||||
|                         while (!participants.All(p => p.Total >= 60)) | ||||
|                         { | ||||
|  | ||||
|                             p.Total += 1 + rng.Next(0, 10); | ||||
|                             if (p.Total > 60) | ||||
|                             //update the state | ||||
|                             participants.ForEach(p => | ||||
|                             { | ||||
|                                 p.Total = 60; | ||||
|                                 if (winner == null) | ||||
|  | ||||
|                                 p.Total += 1 + rng.Next(0, 10); | ||||
|                                 if (p.Total > 60) | ||||
|                                 { | ||||
|                                     winner = p; | ||||
|                                     p.Total = 60; | ||||
|                                     if (winner == null) | ||||
|                                     { | ||||
|                                         winner = p; | ||||
|                                     } | ||||
|                                     if (p.Place == 0) | ||||
|                                         p.Place = place++; | ||||
|                                 } | ||||
|                                 if (p.Place == 0) | ||||
|                                     p.Place = place++; | ||||
|                             } | ||||
|                         }); | ||||
|                             }); | ||||
|  | ||||
|  | ||||
|                         //draw the state | ||||
|                             //draw the state | ||||
|  | ||||
|                         var text = $@"|🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🔚| | ||||
|                             var text = $@"|🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🔚| | ||||
| {String.Join("\n", participants.Select(p => $"{(int)(p.Total / 60f * 100),-2}%|{p.ToString()}"))} | ||||
| |🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🔚|"; | ||||
|                         if (msg == null || messagesSinceGameStarted >= 10) // also resend the message if channel was spammed | ||||
|                         { | ||||
|                             if (msg != null) | ||||
|                                 try { await msg.Delete(); } catch { } | ||||
|                             msg = await raceChannel.SendMessage(text); | ||||
|                             messagesSinceGameStarted = 0; | ||||
|                         } | ||||
|                         else | ||||
|                             await msg.Edit(text); | ||||
|                             if (msg == null || messagesSinceGameStarted >= 10) // also resend the message if channel was spammed | ||||
|                             { | ||||
|                                 if (msg != null) | ||||
|                                     try { await msg.DeleteAsync(); } catch { } | ||||
|                                 msg = await raceChannel.SendMessageAsync(text).ConfigureAwait(false); | ||||
|                                 messagesSinceGameStarted = 0; | ||||
|                             } | ||||
|                             else | ||||
|                                 await msg.ModifyAsync(m => m.Content = text).ConfigureAwait(false); | ||||
|  | ||||
|                         await Task.Delay(2500); | ||||
|                             await Task.Delay(2500); | ||||
|                         } | ||||
|                     } | ||||
|                     finally | ||||
|                     { | ||||
|                         NadekoBot.Client.MessageReceived -= Client_MessageReceived; | ||||
|                     } | ||||
|  | ||||
|                     if (winner.AmountBet > 0) | ||||
|                     { | ||||
|                         var wonAmount = winner.AmountBet * (participants.Count - 1); | ||||
|                         //todo DB | ||||
|                         //await FlowersHandler.AddFlowersAsync(winner.User, "Won a Race", wonAmount).ConfigureAwait(false); | ||||
|                         await raceChannel.SendMessageAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{NadekoBot.Config.Currency.Sign}!**").ConfigureAwait(false); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         await raceChannel.SendMessageAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race!**"); | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|  | ||||
|                 private async Task Client_MessageReceived(IMessage imsg) | ||||
|                 { | ||||
|                     if (await imsg.IsAuthor(NadekoBot.Client) || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel) | ||||
|                         return; | ||||
|                     messagesSinceGameStarted++; | ||||
|                 } | ||||
|  | ||||
|                 private async Task CheckForFullGameAsync(CancellationToken cancelToken) | ||||
|                 { | ||||
|                     while (animals.Count > 0) | ||||
|                     { | ||||
|                         await Task.Delay(100, cancelToken); | ||||
|                     } | ||||
|                 } | ||||
|                 finally | ||||
|                 { | ||||
|                     NadekoBot.Client.MessageReceived -= Client_MessageReceived; | ||||
|                 } | ||||
|  | ||||
|                 if (winner.AmountBet > 0) | ||||
|                 public async Task<bool> JoinRace(IGuildUser u, int amount = 0) | ||||
|                 { | ||||
|                     var wonAmount = winner.AmountBet * (participants.Count - 1); | ||||
|                     await FlowersHandler.AddFlowersAsync(winner.User, "Won a Race", wonAmount).ConfigureAwait(false); | ||||
|                     await raceChannel.SendMessage($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{NadekoBot.Config.CurrencySign}!**"); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     await raceChannel.SendMessage($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race!**"); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|  | ||||
|             private void Client_MessageReceived(IMessage imsg) | ||||
|             { | ||||
|                 if (e.Message.IsAuthor || e.Channel.IsPrivate || e.Channel != raceChannel) | ||||
|                     return; | ||||
|                 messagesSinceGameStarted++; | ||||
|             } | ||||
|  | ||||
|             private async Task CheckForFullGameAsync(CancellationToken cancelToken) | ||||
|             { | ||||
|                 while (animals.Count > 0) | ||||
|                 { | ||||
|                     await Task.Delay(100, cancelToken); | ||||
|                     var animal = ""; | ||||
|                     if (!animals.TryDequeue(out animal)) | ||||
|                     { | ||||
|                         await raceChannel.SendMessageAsync($"{u.Mention} `There is no running race on this server.`"); | ||||
|                         return false; | ||||
|                     } | ||||
|                     var p = new Participant(u, animal, amount); | ||||
|                     if (participants.Contains(p)) | ||||
|                     { | ||||
|                         await raceChannel.SendMessageAsync($"{u.Mention} `You already joined this race.`"); | ||||
|                         return false; | ||||
|                     } | ||||
|                     if (Started) | ||||
|                     { | ||||
|                         await raceChannel.SendMessageAsync($"{u.Mention} `Race is already started`"); | ||||
|                         return false; | ||||
|                     } | ||||
|                     participants.Add(p); | ||||
|                     await raceChannel.SendMessageAsync($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {(amount == 1? NadekoBot.Config.Currency.Name: NadekoBot.Config.Currency.PluralName)}!**" : "**")); | ||||
|                     return true; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             public async Task<bool> JoinRace(IGuildUser u, int amount = 0) | ||||
|             public class Participant | ||||
|             { | ||||
|                 var animal = ""; | ||||
|                 if (!animals.TryDequeue(out animal)) | ||||
|                 { | ||||
|                     await raceChannel.SendMessage($"{u.Mention} `There is no running race on this server.`"); | ||||
|                     return false; | ||||
|                 } | ||||
|                 var p = new Participant(u, animal, amount); | ||||
|                 if (participants.Contains(p)) | ||||
|                 { | ||||
|                     await raceChannel.SendMessage($"{u.Mention} `You already joined this race.`"); | ||||
|                     return false; | ||||
|                 } | ||||
|                 if (Started) | ||||
|                 { | ||||
|                     await raceChannel.SendMessage($"{u.Mention} `Race is already started`"); | ||||
|                     return false; | ||||
|                 } | ||||
|                 participants.Add(p); | ||||
|                 await raceChannel.SendMessage($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {NadekoBot.Config.CurrencyName.SnPl(amount)}!**" : "**")); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|                 public IGuildUser User { get; set; } | ||||
|                 public string Animal { get; set; } | ||||
|                 public int AmountBet { get; set; } | ||||
|  | ||||
|         public class Participant | ||||
|         { | ||||
|             public IGuildUser User { get; set; } | ||||
|             public string Animal { get; set; } | ||||
|             public int AmountBet { get; set; } | ||||
|                 public float Coeff { get; set; } | ||||
|                 public int Total { get; set; } | ||||
|  | ||||
|             public float Coeff { get; set; } | ||||
|             public int Total { get; set; } | ||||
|                 public int Place { get; set; } = 0; | ||||
|  | ||||
|             public int Place { get; set; } = 0; | ||||
|  | ||||
|             public Participant(IGuildUser u, string a, int amount) | ||||
|             { | ||||
|                 this.User = u; | ||||
|                 this.Animal = a; | ||||
|                 this.AmountBet = amount; | ||||
|             } | ||||
|  | ||||
|             public override int GetHashCode() | ||||
|             { | ||||
|                 return User.GetHashCode(); | ||||
|             } | ||||
|  | ||||
|             public override bool Equals(object obj) | ||||
|             { | ||||
|                 var p = obj as Participant; | ||||
|                 return p == null ? | ||||
|                     false : | ||||
|                     p.User == User; | ||||
|             } | ||||
|  | ||||
|             public override string ToString() | ||||
|             { | ||||
|                 var str = new string('‣', Total) + Animal; | ||||
|                 if (Place == 0) | ||||
|                     return str; | ||||
|                 if (Place == 1) | ||||
|                 public Participant(IGuildUser u, string a, int amount) | ||||
|                 { | ||||
|                     return str + "🏆"; | ||||
|                 } | ||||
|                 else if (Place == 2) | ||||
|                 { | ||||
|                     return str + "`2nd`"; | ||||
|                 } | ||||
|                 else if (Place == 3) | ||||
|                 { | ||||
|                     return str + "`3rd`"; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return str + $"`{Place}th`"; | ||||
|                     this.User = u; | ||||
|                     this.Animal = a; | ||||
|                     this.AmountBet = amount; | ||||
|                 } | ||||
|  | ||||
|                 public override int GetHashCode() | ||||
|                 { | ||||
|                     return User.GetHashCode(); | ||||
|                 } | ||||
|  | ||||
|                 public override bool Equals(object obj) | ||||
|                 { | ||||
|                     var p = obj as Participant; | ||||
|                     return p == null ? | ||||
|                         false : | ||||
|                         p.User == User; | ||||
|                 } | ||||
|  | ||||
|                 public override string ToString() | ||||
|                 { | ||||
|                     var str = new string('‣', Total) + Animal; | ||||
|                     if (Place == 0) | ||||
|                         return str; | ||||
|                     if (Place == 1) | ||||
|                     { | ||||
|                         return str + "🏆"; | ||||
|                     } | ||||
|                     else if (Place == 2) | ||||
|                     { | ||||
|                         return str + "`2nd`"; | ||||
|                     } | ||||
|                     else if (Place == 3) | ||||
|                     { | ||||
|                         return str + "`3rd`"; | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         return str + $"`{Place}th`"; | ||||
|                     } | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -69,10 +69,10 @@ | ||||
| //                IsActive = true; | ||||
| //                CurrentSentence = SentencesProvider.GetRandomSentence(); | ||||
| //                var i = (int)(CurrentSentence.Length / WORD_VALUE * 1.7f); | ||||
| //                await channel.SendMessage($":clock2: Next contest will last for {i} seconds. Type the bolded text as fast as you can.").ConfigureAwait(false); | ||||
| //                await channel.SendMessageAsync($":clock2: Next contest will last for {i} seconds. Type the bolded text as fast as you can.").ConfigureAwait(false); | ||||
|  | ||||
|  | ||||
| //                var msg = await channel.SendMessage("Starting new typing contest in **3**...").ConfigureAwait(false); | ||||
| //                var msg = await channel.SendMessageAsync("Starting new typing contest in **3**...").ConfigureAwait(false); | ||||
| //                await Task.Delay(1000).ConfigureAwait(false); | ||||
| //                await msg.Edit("Starting new typing contest in **2**...").ConfigureAwait(false); | ||||
| //                await Task.Delay(1000).ConfigureAwait(false); | ||||
|   | ||||
| @@ -63,7 +63,7 @@ | ||||
| //                                        msg += $"\n`Here is the Link:`【 http://www.beam.pro/{stream.Username}/ 】"; | ||||
| //                                    else if (stream.Type == StreamNotificationConfig.StreamType.YoutubeGaming) | ||||
| //                                        msg += $"\n`Here is the Link:`【 not implemented yet - {stream.Username} 】"; | ||||
| //                                await channel.SendMessage(msg).ConfigureAwait(false); | ||||
| //                                await channel.SendMessageAsync(msg).ConfigureAwait(false); | ||||
| //                            } | ||||
| //                        } | ||||
| //                        FirstPass = false; | ||||
|   | ||||
| @@ -61,7 +61,7 @@ | ||||
| //                    if (ch == null) | ||||
| //                        return; | ||||
|  | ||||
| //                    await ch.SendMessage( | ||||
| //                    await ch.SendMessageAsync( | ||||
| //                        replacements.Aggregate(NadekoBot.Config.RemindMessageFormat, | ||||
| //                        (cur, replace) => cur.Replace(replace.Key, replace.Value(r))) | ||||
| //                            ).ConfigureAwait(false); //it works trust me | ||||
|   | ||||
| @@ -633,7 +633,7 @@ namespace NadekoBot.Modules.Music | ||||
|                         var textCh = e.Channel; | ||||
|                         if (voiceCh == null || voiceCh.Server != textCh.Server) | ||||
|                         { | ||||
|                             await textCh.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.").ConfigureAwait(false); | ||||
|                             await textCh.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.").ConfigureAwait(false); | ||||
|                             return; | ||||
|                         } | ||||
|                         var name = e.GetArg("name")?.Trim().ToLowerInvariant(); | ||||
| @@ -812,7 +812,7 @@ namespace NadekoBot.Modules.Music | ||||
|             if (voiceCh == null || voiceCh.Server != textCh.Server) | ||||
|             { | ||||
|                 if (!silent) | ||||
|                     await textCh.SendMessage("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.").ConfigureAwait(false); | ||||
|                     await textCh.SendMessageAsync("💢 You need to be in a voice channel on this server.\n If you are already in a voice channel, try rejoining.").ConfigureAwait(false); | ||||
|                 throw new ArgumentNullException(nameof(voiceCh)); | ||||
|             } | ||||
|             if (string.IsNullOrWhiteSpace(query) || query.Length < 3) | ||||
| @@ -836,7 +836,7 @@ namespace NadekoBot.Modules.Music | ||||
|                                 await lastFinishedMessage.Delete().ConfigureAwait(false); | ||||
|                             if (playingMessage != null) | ||||
|                                 await playingMessage.Delete().ConfigureAwait(false); | ||||
|                             lastFinishedMessage = await textCh.SendMessage($"🎵`Finished`{song.PrettyName}").ConfigureAwait(false); | ||||
|                             lastFinishedMessage = await textCh.SendMessageAsync($"🎵`Finished`{song.PrettyName}").ConfigureAwait(false); | ||||
|                             if (mp.Autoplay && mp.Playlist.Count == 0 && song.SongInfo.Provider == "YouTube") | ||||
|                             { | ||||
|                                 await QueueSong(queuer.Server.CurrentUser, textCh, voiceCh, (await SearchHelper.GetRelatedVideoIds(song.SongInfo.Query, 4)).ToList().Shuffle().FirstOrDefault(), silent, musicType).ConfigureAwait(false); | ||||
| @@ -860,7 +860,7 @@ namespace NadekoBot.Modules.Music | ||||
|                         { | ||||
|  | ||||
|                             var msgTxt = $"🎵`Playing`{song.PrettyName} `Vol: {(int)(sender.Volume * 100)}%`"; | ||||
|                             playingMessage = await textCh.SendMessage(msgTxt).ConfigureAwait(false); | ||||
|                             playingMessage = await textCh.SendMessageAsync(msgTxt).ConfigureAwait(false); | ||||
|                         } | ||||
|                         catch { } | ||||
|                     } | ||||
| @@ -877,12 +877,12 @@ namespace NadekoBot.Modules.Music | ||||
|             } | ||||
|             catch (PlaylistFullException) | ||||
|             { | ||||
|                 await textCh.SendMessage($"🎵 `Queue is full at {musicPlayer.MaxQueueSize}/{musicPlayer.MaxQueueSize}.` "); | ||||
|                 await textCh.SendMessageAsync($"🎵 `Queue is full at {musicPlayer.MaxQueueSize}/{musicPlayer.MaxQueueSize}.` "); | ||||
|                 throw; | ||||
|             } | ||||
|             if (!silent) | ||||
|             { | ||||
|                 var queuedMessage = await textCh.SendMessage($"🎵`Queued`{resolvedSong.PrettyName} **at** `#{musicPlayer.Playlist.Count + 1}`").ConfigureAwait(false); | ||||
|                 var queuedMessage = await textCh.SendMessageAsync($"🎵`Queued`{resolvedSong.PrettyName} **at** `#{musicPlayer.Playlist.Count + 1}`").ConfigureAwait(false); | ||||
| #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed | ||||
|                 Task.Run(async () => | ||||
|                                 { | ||||
|   | ||||
| @@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Permissions.Commands | ||||
|                                                              $"INVITE LINK in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" + | ||||
|                                                              $"`Full message:` {args.Message.Text}"); | ||||
|                         if (serverPerms.Verbose) | ||||
|                             await args.Channel.SendMessage($"{args.User.Mention} Invite links are not " + | ||||
|                             await args.Channel.SendMessageAsync($"{args.User.Mention} Invite links are not " + | ||||
|                                                            $"allowed on this channel.") | ||||
|                                                            .ConfigureAwait(false); | ||||
|                     } | ||||
|   | ||||
| @@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Permissions.Commands | ||||
|                                                              $"BANNED WORD in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" + | ||||
|                                                              $"`Full message:` {args.Message.Text}"); | ||||
|                         if (serverPerms.Verbose) | ||||
|                             await args.Channel.SendMessage($"{args.User.Mention} One or more of the words you used " + | ||||
|                             await args.Channel.SendMessageAsync($"{args.User.Mention} One or more of the words you used " + | ||||
|                                                            $"in that sentence are not allowed here.") | ||||
|                                                            .ConfigureAwait(false); | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user