Animal racing done, more mass replacements
This commit is contained in:
parent
43c9e7d04d
commit
acebc6e914
@ -23,7 +23,7 @@ namespace NadekoBot.Classes
|
|||||||
|
|
||||||
var flows = amount + " " + NadekoBot.Config.CurrencySign;
|
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.`")
|
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)
|
if (silent)
|
||||||
return true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
// {
|
// {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// await channel.SendMessage(msg);
|
// await channel.SendMessageAsync(msg);
|
||||||
// }
|
// }
|
||||||
// else if (ids[1].ToUpperInvariant().StartsWith("U:"))
|
// else if (ids[1].ToUpperInvariant().StartsWith("U:"))
|
||||||
// {
|
// {
|
||||||
@ -553,7 +553,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
// {
|
// {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// await user.SendMessage(msg);
|
// await user.SendMessageAsync(msg);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// continue;
|
// continue;
|
||||||
// foreach (var chan in set.Except(new[] { e.Channel }))
|
// 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))
|
// if (Subscribers.TryAdd(token, set))
|
||||||
// {
|
// {
|
||||||
// set.Add(e.Channel);
|
// 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);
|
// 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; }));
|
// 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")
|
// cgb.CreateCommand(Module.Prefix + "listallincidents")
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
// if (usr?.Status != UserStatus.Offline)
|
// if (usr?.Status != UserStatus.Offline)
|
||||||
// return;
|
// return;
|
||||||
// await 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.SendMessageAsync(
|
||||||
// $"User `{imsg.Author.Username}` mentioned you on " +
|
// $"User `{imsg.Author.Username}` mentioned you on " +
|
||||||
// $"`{e.Server.Name}` server while you were offline.\n" +
|
// $"`{e.Server.Name}` server while you were offline.\n" +
|
||||||
// $"`Message:` {e.Message.Text}").ConfigureAwait(false);
|
// $"`Message:` {e.Message.Text}").ConfigureAwait(false);
|
||||||
@ -76,7 +76,7 @@
|
|||||||
// //send merged messages to each channel
|
// //send merged messages to each channel
|
||||||
// foreach (var k in toSend)
|
// 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);
|
// await Task.Delay(5000);
|
||||||
@ -96,10 +96,10 @@
|
|||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// return;
|
||||||
// if (e.Before.Name != e.After.Name)
|
// 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);
|
// `New:` {e.After.Name}").ConfigureAwait(false);
|
||||||
// else if (e.Before.Topic != e.After.Topic)
|
// 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}
|
// `Old:` {e.Before.Topic}
|
||||||
// `New:` {e.After.Topic}").ConfigureAwait(false);
|
// `New:` {e.After.Topic}").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
@ -117,7 +117,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -133,7 +133,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -148,7 +148,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -163,7 +163,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -178,7 +178,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -193,7 +193,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// 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 { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
@ -213,13 +213,13 @@
|
|||||||
// return;
|
// return;
|
||||||
// if (!string.IsNullOrWhiteSpace(e.Message.Text))
|
// if (!string.IsNullOrWhiteSpace(e.Message.Text))
|
||||||
// {
|
// {
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}`
|
// $@"🕔`{prettyCurrentTime}` **New Message** `#{e.Channel.Name}`
|
||||||
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false);
|
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// $@"🕔`{prettyCurrentTime}` **File Uploaded** `#{e.Channel.Name}`
|
// $@"🕔`{prettyCurrentTime}` **File Uploaded** `#{e.Channel.Name}`
|
||||||
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false);
|
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
@ -242,13 +242,13 @@
|
|||||||
// return;
|
// return;
|
||||||
// if (!string.IsNullOrWhiteSpace(e.Message.Text))
|
// if (!string.IsNullOrWhiteSpace(e.Message.Text))
|
||||||
// {
|
// {
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// $@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}`
|
// $@"🕔`{prettyCurrentTime}` **Message** 🚮 `#{e.Channel.Name}`
|
||||||
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false);
|
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Text.Unmention()}").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// $@"🕔`{prettyCurrentTime}` **File Deleted** `#{e.Channel.Name}`
|
// $@"🕔`{prettyCurrentTime}` **File Deleted** `#{e.Channel.Name}`
|
||||||
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false);
|
//👤`{imsg.Author?.ToString() ?? ("NULL")}` {e.Message.Attachments.FirstOrDefault()?.ProxyUrl}").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
@ -268,7 +268,7 @@
|
|||||||
// Channel ch;
|
// Channel ch;
|
||||||
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
// if ((ch = e.Server.TextChannels.Where(tc => tc.Id == chId).FirstOrDefault()) == null)
|
||||||
// return;
|
// return;
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
|
// $@"🕔`{prettyCurrentTime}` **Message** 📝 `#{e.Channel.Name}`
|
||||||
//👤`{imsg.Author?.ToString() ?? ("NULL")}`
|
//👤`{imsg.Author?.ToString() ?? ("NULL")}`
|
||||||
// `Old:` {e.Before.Text.Unmention()}
|
// `Old:` {e.Before.Text.Unmention()}
|
||||||
@ -318,15 +318,15 @@
|
|||||||
// }
|
// }
|
||||||
// if ((notifyLeave && notifyJoin) && (notifyChAfter == notifyChBefore))
|
// 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)
|
// 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)
|
// 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
|
// else
|
||||||
// return;
|
// return;
|
||||||
// await ch.SendMessage(str).ConfigureAwait(false);
|
// await ch.SendMessageAsync(str).ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
// catch { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
// catch { }
|
// catch { }
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// lastMessage = await ch.SendMessage(msg).ConfigureAwait(false);
|
// lastMessage = await ch.SendMessageAsync(msg).ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
// catch { }
|
// catch { }
|
||||||
// }
|
// }
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
// Greeted++;
|
// Greeted++;
|
||||||
// try
|
// 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 { }
|
// catch { }
|
||||||
@ -57,7 +57,7 @@
|
|||||||
// {
|
// {
|
||||||
// if (channel == null) return;
|
// if (channel == null) return;
|
||||||
// Greeted++;
|
// 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)
|
// if (e.Server.CurrentUser.GetPermissions(channel).ManageMessages && controls.DeleteGreetMessages)
|
||||||
// {
|
// {
|
||||||
// await Task.Delay(30000).ConfigureAwait(false); // 5 minutes
|
// await Task.Delay(30000).ConfigureAwait(false); // 5 minutes
|
||||||
@ -84,13 +84,13 @@
|
|||||||
// if (controls.GreetPM)
|
// if (controls.GreetPM)
|
||||||
// {
|
// {
|
||||||
// Greeted++;
|
// 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
|
// else
|
||||||
// {
|
// {
|
||||||
// if (channel == null) return;
|
// if (channel == null) return;
|
||||||
// Greeted++;
|
// 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)
|
// if (e.Server.CurrentUser.GetPermissions(channel).ManageMessages && controls.DeleteGreetMessages)
|
||||||
// {
|
// {
|
||||||
// await Task.Delay(30000).ConfigureAwait(false); // 5 minutes
|
// await Task.Delay(30000).ConfigureAwait(false); // 5 minutes
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// await e.Server.Owner.SendMessage(
|
// await e.Server.Owner.SendMessageAsync(
|
||||||
// "I don't have manage server and/or Manage Channels permission," +
|
// "I don't have manage server and/or Manage Channels permission," +
|
||||||
// $" so I cannot run voice+text on **{e.Server.Name}** server.").ConfigureAwait(false);
|
// $" so I cannot run voice+text on **{e.Server.Name}** server.").ConfigureAwait(false);
|
||||||
// }
|
// }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
|
using NadekoBot.Attributes;
|
||||||
using NadekoBot.Classes;
|
using NadekoBot.Classes;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System;
|
using System;
|
||||||
@ -11,285 +12,282 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace NadekoBot.Modules.Gambling.Commands
|
namespace NadekoBot.Modules.Gambling.Commands
|
||||||
{
|
{
|
||||||
[Group]
|
public partial class Gambling
|
||||||
class AnimalRacing
|
|
||||||
{
|
{
|
||||||
public static ConcurrentDictionary<ulong, AnimalRace> AnimalRaces = new ConcurrentDictionary<ulong, AnimalRace>();
|
[Group]
|
||||||
|
public class AnimalRacing
|
||||||
public AnimalRacing(DiscordModule module) : base(module)
|
|
||||||
{
|
{
|
||||||
}
|
public static ConcurrentDictionary<ulong, AnimalRace> AnimalRaces = new ConcurrentDictionary<ulong, AnimalRace>();
|
||||||
|
|
||||||
internal override void Init(CommandGroupBuilder cgb)
|
[LocalizedCommand, LocalizedDescription, LocalizedSummary]
|
||||||
{
|
[RequireContext(ContextType.Guild)]
|
||||||
cgb.CreateCommand(Prefix + "race")
|
public async Task Race(IMessage imsg)
|
||||||
.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)
|
|
||||||
{
|
{
|
||||||
this.serverId = serverId;
|
var channel = imsg.Channel as ITextChannel;
|
||||||
this.raceChannel = ch;
|
|
||||||
if (!AnimalRaces.TryAdd(serverId, this))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
var cancelSource = new CancellationTokenSource();
|
await ar.JoinRace(imsg.Author as IGuildUser, amount);
|
||||||
var token = cancelSource.Token;
|
}
|
||||||
var fullgame = CheckForFullGameAsync(token);
|
|
||||||
Task.Run(async () =>
|
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
|
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.`");
|
NadekoBot.Client.MessageReceived += Client_MessageReceived;
|
||||||
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 { }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void End()
|
while (!participants.All(p => p.Total >= 60))
|
||||||
{
|
|
||||||
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 =>
|
|
||||||
{
|
{
|
||||||
|
//update the state
|
||||||
p.Total += 1 + rng.Next(0, 10);
|
participants.ForEach(p =>
|
||||||
if (p.Total > 60)
|
|
||||||
{
|
{
|
||||||
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()}"))}
|
{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 || messagesSinceGameStarted >= 10) // also resend the message if channel was spammed
|
||||||
{
|
{
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
try { await msg.Delete(); } catch { }
|
try { await msg.DeleteAsync(); } catch { }
|
||||||
msg = await raceChannel.SendMessage(text);
|
msg = await raceChannel.SendMessageAsync(text).ConfigureAwait(false);
|
||||||
messagesSinceGameStarted = 0;
|
messagesSinceGameStarted = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await msg.Edit(text);
|
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);
|
var animal = "";
|
||||||
await FlowersHandler.AddFlowersAsync(winner.User, "Won a Race", wonAmount).ConfigureAwait(false);
|
if (!animals.TryDequeue(out animal))
|
||||||
await raceChannel.SendMessage($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{NadekoBot.Config.CurrencySign}!**");
|
{
|
||||||
}
|
await raceChannel.SendMessageAsync($"{u.Mention} `There is no running race on this server.`");
|
||||||
else
|
return false;
|
||||||
{
|
}
|
||||||
await raceChannel.SendMessage($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race!**");
|
var p = new Participant(u, animal, amount);
|
||||||
}
|
if (participants.Contains(p))
|
||||||
|
{
|
||||||
}
|
await raceChannel.SendMessageAsync($"{u.Mention} `You already joined this race.`");
|
||||||
|
return false;
|
||||||
private void Client_MessageReceived(IMessage imsg)
|
}
|
||||||
{
|
if (Started)
|
||||||
if (e.Message.IsAuthor || e.Channel.IsPrivate || e.Channel != raceChannel)
|
{
|
||||||
return;
|
await raceChannel.SendMessageAsync($"{u.Mention} `Race is already started`");
|
||||||
messagesSinceGameStarted++;
|
return false;
|
||||||
}
|
}
|
||||||
|
participants.Add(p);
|
||||||
private async Task CheckForFullGameAsync(CancellationToken cancelToken)
|
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;
|
||||||
while (animals.Count > 0)
|
|
||||||
{
|
|
||||||
await Task.Delay(100, cancelToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> JoinRace(IGuildUser u, int amount = 0)
|
public class Participant
|
||||||
{
|
{
|
||||||
var animal = "";
|
public IGuildUser User { get; set; }
|
||||||
if (!animals.TryDequeue(out animal))
|
public string Animal { get; set; }
|
||||||
{
|
public int AmountBet { get; set; }
|
||||||
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 class Participant
|
public float Coeff { get; set; }
|
||||||
{
|
public int Total { get; set; }
|
||||||
public IGuildUser User { get; set; }
|
|
||||||
public string Animal { get; set; }
|
|
||||||
public int AmountBet { get; set; }
|
|
||||||
|
|
||||||
public float Coeff { get; set; }
|
public int Place { get; set; } = 0;
|
||||||
public int Total { get; set; }
|
|
||||||
|
|
||||||
public int Place { get; set; } = 0;
|
public Participant(IGuildUser u, string a, int amount)
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
return str + "🏆";
|
this.User = u;
|
||||||
}
|
this.Animal = a;
|
||||||
else if (Place == 2)
|
this.AmountBet = amount;
|
||||||
{
|
|
||||||
return str + "`2nd`";
|
|
||||||
}
|
|
||||||
else if (Place == 3)
|
|
||||||
{
|
|
||||||
return str + "`3rd`";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return str + $"`{Place}th`";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
// IsActive = true;
|
||||||
// CurrentSentence = SentencesProvider.GetRandomSentence();
|
// CurrentSentence = SentencesProvider.GetRandomSentence();
|
||||||
// var i = (int)(CurrentSentence.Length / WORD_VALUE * 1.7f);
|
// 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 Task.Delay(1000).ConfigureAwait(false);
|
||||||
// await msg.Edit("Starting new typing contest in **2**...").ConfigureAwait(false);
|
// await msg.Edit("Starting new typing contest in **2**...").ConfigureAwait(false);
|
||||||
// await Task.Delay(1000).ConfigureAwait(false);
|
// await Task.Delay(1000).ConfigureAwait(false);
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
// msg += $"\n`Here is the Link:`【 http://www.beam.pro/{stream.Username}/ 】";
|
// msg += $"\n`Here is the Link:`【 http://www.beam.pro/{stream.Username}/ 】";
|
||||||
// else if (stream.Type == StreamNotificationConfig.StreamType.YoutubeGaming)
|
// else if (stream.Type == StreamNotificationConfig.StreamType.YoutubeGaming)
|
||||||
// msg += $"\n`Here is the Link:`【 not implemented yet - {stream.Username} 】";
|
// 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;
|
// FirstPass = false;
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
// if (ch == null)
|
// if (ch == null)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
// await ch.SendMessage(
|
// await ch.SendMessageAsync(
|
||||||
// replacements.Aggregate(NadekoBot.Config.RemindMessageFormat,
|
// replacements.Aggregate(NadekoBot.Config.RemindMessageFormat,
|
||||||
// (cur, replace) => cur.Replace(replace.Key, replace.Value(r)))
|
// (cur, replace) => cur.Replace(replace.Key, replace.Value(r)))
|
||||||
// ).ConfigureAwait(false); //it works trust me
|
// ).ConfigureAwait(false); //it works trust me
|
||||||
|
@ -633,7 +633,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
var textCh = e.Channel;
|
var textCh = e.Channel;
|
||||||
if (voiceCh == null || voiceCh.Server != textCh.Server)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
var name = e.GetArg("name")?.Trim().ToLowerInvariant();
|
var name = e.GetArg("name")?.Trim().ToLowerInvariant();
|
||||||
@ -812,7 +812,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
if (voiceCh == null || voiceCh.Server != textCh.Server)
|
if (voiceCh == null || voiceCh.Server != textCh.Server)
|
||||||
{
|
{
|
||||||
if (!silent)
|
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));
|
throw new ArgumentNullException(nameof(voiceCh));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(query) || query.Length < 3)
|
if (string.IsNullOrWhiteSpace(query) || query.Length < 3)
|
||||||
@ -836,7 +836,7 @@ namespace NadekoBot.Modules.Music
|
|||||||
await lastFinishedMessage.Delete().ConfigureAwait(false);
|
await lastFinishedMessage.Delete().ConfigureAwait(false);
|
||||||
if (playingMessage != null)
|
if (playingMessage != null)
|
||||||
await playingMessage.Delete().ConfigureAwait(false);
|
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")
|
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);
|
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)}%`";
|
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 { }
|
catch { }
|
||||||
}
|
}
|
||||||
@ -877,12 +877,12 @@ namespace NadekoBot.Modules.Music
|
|||||||
}
|
}
|
||||||
catch (PlaylistFullException)
|
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;
|
throw;
|
||||||
}
|
}
|
||||||
if (!silent)
|
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
|
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Permissions.Commands
|
|||||||
$"INVITE LINK in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" +
|
$"INVITE LINK in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" +
|
||||||
$"`Full message:` {args.Message.Text}");
|
$"`Full message:` {args.Message.Text}");
|
||||||
if (serverPerms.Verbose)
|
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.")
|
$"allowed on this channel.")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Permissions.Commands
|
|||||||
$"BANNED WORD in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" +
|
$"BANNED WORD in [{args.Channel.Name}/{args.Channel.Id}] channel.\n" +
|
||||||
$"`Full message:` {args.Message.Text}");
|
$"`Full message:` {args.Message.Text}");
|
||||||
if (serverPerms.Verbose)
|
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.")
|
$"in that sentence are not allowed here.")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user