small change, ready for external prefixes
This commit is contained in:
parent
dc8769d661
commit
50cd1f50b5
@ -146,7 +146,7 @@ public class Cards
|
||||
}
|
||||
public override string ToString() => string.Join("", cardPool.Select(c => c.ToString())) + Environment.NewLine;
|
||||
|
||||
public void InitHandValues() {
|
||||
internal override void InitHandValues() {
|
||||
Func<List<Card>, bool> hasPair =
|
||||
cards => cards.GroupBy(card => card.Number)
|
||||
.Count(group => group.Count() == 2) == 1;
|
||||
|
@ -6,18 +6,17 @@ using Discord.Commands;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class ClashOfClans : IDiscordCommand {
|
||||
internal class ClashOfClans : DiscordCommand {
|
||||
private const string prefix = ",";
|
||||
|
||||
public static ConcurrentDictionary<ulong, List<ClashWar>> ClashWars { get; } = new ConcurrentDictionary<ulong, List<ClashWar>>();
|
||||
|
||||
private readonly object writeLock = new object();
|
||||
|
||||
public ClashOfClans() {
|
||||
|
||||
}
|
||||
public ClashOfClans(DiscordModule module) : base(module) { }
|
||||
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async e => {
|
||||
if (!e.User.ServerPermissions.ManageChannels)
|
||||
@ -44,20 +43,18 @@ namespace NadekoBot.Commands {
|
||||
try {
|
||||
await
|
||||
e.Channel.SendMessage($"❗🔰**Claim from @{u} for a war against {cw.ShortPrint()} has expired.**");
|
||||
}
|
||||
catch {}
|
||||
} catch { }
|
||||
};
|
||||
cw.OnWarEnded += async () => {
|
||||
try {
|
||||
await e.Channel.SendMessage($"❗🔰**War against {cw.ShortPrint()} ended.**");
|
||||
}
|
||||
catch {}
|
||||
} catch { }
|
||||
};
|
||||
await e.Channel.SendMessage($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**");
|
||||
//war with the index X started.
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(prefix + "createwar")
|
||||
.Alias(prefix + "cw")
|
||||
.Description($"Creates a new war by specifying a size (>10 and multiple of 5) and enemy clan name.\n**Usage**:{prefix}cw 15 The Enemy Clan")
|
||||
@ -200,33 +197,6 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage($"💢🔰 {ex.Message}");
|
||||
}
|
||||
});
|
||||
/*
|
||||
cgb.CreateCommand(prefix + "forceunclaim")
|
||||
.Alias(prefix + "forceuncall")
|
||||
.Alias(prefix + "fuc")
|
||||
.Description($"Force removes a base claim from a certain war from a certain base. \n**Usage**: {prefix}fuc [war_number] [base_number]")
|
||||
.Parameter("number", ParameterType.Required)
|
||||
.Parameter("other_name", ParameterType.Unparsed)
|
||||
.Do(async e => {
|
||||
var warsInfo = GetInfo(e);
|
||||
if (warsInfo == null || warsInfo.Item1.Count == 0) {
|
||||
await e.Channel.SendMessage("💢🔰 **That war does not exist.**");
|
||||
return;
|
||||
}
|
||||
string usr =
|
||||
string.IsNullOrWhiteSpace(e.GetArg("other_name")) ?
|
||||
e.User.Name :
|
||||
e.GetArg("other_name").Trim();
|
||||
try {
|
||||
var war = warsInfo.Item1[warsInfo.Item2];
|
||||
int baseNumber = war.Uncall(usr);
|
||||
await e.Channel.SendMessage($"🔰 @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
await e.Channel.SendMessage($"💢🔰 {ex.Message}");
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
cgb.CreateCommand(prefix + "endwar")
|
||||
.Alias(prefix + "ew")
|
||||
|
@ -2,40 +2,34 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands
|
||||
{
|
||||
internal class CopyCommand : IDiscordCommand
|
||||
{
|
||||
namespace NadekoBot.Commands {
|
||||
internal class CopyCommand : DiscordCommand {
|
||||
private readonly HashSet<ulong> CopiedUsers = new HashSet<ulong>();
|
||||
|
||||
public CopyCommand()
|
||||
{
|
||||
public CopyCommand(DiscordModule module) : base(module) {
|
||||
NadekoBot.Client.MessageReceived += Client_MessageReceived;
|
||||
}
|
||||
|
||||
private async void Client_MessageReceived(object sender, Discord.MessageEventArgs e)
|
||||
{
|
||||
private async void Client_MessageReceived(object sender, Discord.MessageEventArgs e) {
|
||||
try {
|
||||
if (string.IsNullOrWhiteSpace(e.Message.Text))
|
||||
return;
|
||||
if (CopiedUsers.Contains(e.User.Id)) {
|
||||
await e.Channel.SendMessage(e.Message.Text);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async e =>
|
||||
{
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async e => {
|
||||
if (CopiedUsers.Contains(e.User.Id)) return;
|
||||
|
||||
CopiedUsers.Add(e.User.Id);
|
||||
await e.Channel.SendMessage(" I'll start copying you now.");
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb)
|
||||
{
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("copyme")
|
||||
.Alias("cm")
|
||||
.Description("Nadeko starts copying everything you say. Disable with cs")
|
||||
@ -47,8 +41,7 @@ namespace NadekoBot.Commands
|
||||
.Do(StopCopy());
|
||||
}
|
||||
|
||||
private Func<CommandEventArgs, Task> StopCopy() => async e =>
|
||||
{
|
||||
private Func<CommandEventArgs, Task> StopCopy() => async e => {
|
||||
if (!CopiedUsers.Contains(e.User.Id)) return;
|
||||
|
||||
CopiedUsers.Remove(e.User.Id);
|
||||
|
@ -6,9 +6,12 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class DiceRollCommand : IDiscordCommand {
|
||||
internal class DiceRollCommand : DiscordCommand {
|
||||
|
||||
public DiceRollCommand(DiscordModule module) : base(module) { }
|
||||
|
||||
public Func<CommandEventArgs, Task> DoFunc() {
|
||||
var r = new Random();
|
||||
@ -65,7 +68,7 @@ namespace NadekoBot.Commands {
|
||||
|
||||
private Image GetDice(int num) => Properties.Resources.ResourceManager.GetObject("_" + num) as Image;
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("$roll")
|
||||
.Description("Rolls 2 dice from 0-10. If you supply a number [x] it rolls up to 30 normal dice.\n**Usage**: $roll [x]")
|
||||
.Parameter("num", ParameterType.Optional)
|
||||
@ -97,6 +100,5 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage($":anger: {ex.Message}");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
@ -5,9 +5,10 @@ using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class DrawCommand : IDiscordCommand {
|
||||
internal class DrawCommand : DiscordCommand {
|
||||
private static readonly ConcurrentDictionary<Discord.Server, Cards> AllDecks = new ConcurrentDictionary<Discord.Server, Cards>();
|
||||
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async (e) => {
|
||||
@ -45,7 +46,7 @@ namespace NadekoBot.Commands {
|
||||
}
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("$draw")
|
||||
.Description("Draws a card from the deck.If you supply number [x], she draws up to 5 cards from the deck.\n**Usage**: $draw [x]")
|
||||
.Parameter("count", ParameterType.Optional)
|
||||
@ -66,5 +67,6 @@ namespace NadekoBot.Commands {
|
||||
});
|
||||
}
|
||||
|
||||
public DrawCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,15 @@ using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Classes.Permissions;
|
||||
using NadekoBot.Modules;
|
||||
using ServerPermissions = NadekoBot.Classes.Permissions.ServerPermissions;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class FilterInvitesCommand : IDiscordCommand {
|
||||
internal class FilterInvitesCommand : DiscordCommand {
|
||||
private readonly Regex filterRegex = new Regex(@"(?:discord(?:\.gg|app\.com\/invite)\/(?<id>([\w]{16}|(?:[\w]+-?){3})))");
|
||||
|
||||
|
||||
public FilterInvitesCommand() {
|
||||
public FilterInvitesCommand(DiscordModule module) : base(module) {
|
||||
NadekoBot.Client.MessageReceived += async (sender, args) => {
|
||||
try {
|
||||
ServerPermissions serverPerms;
|
||||
@ -39,7 +40,7 @@ namespace NadekoBot.Commands {
|
||||
return serverPerms.ChannelPermissions.TryGetValue(channel.Id, out perms) && perms.FilterInvites;
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(";cfi")
|
||||
.Alias(";channelfilterinvites")
|
||||
.Description("Enables or disables automatic deleting of invites on the channel." +
|
||||
|
@ -3,9 +3,10 @@ using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class FlipCoinCommand : IDiscordCommand {
|
||||
internal class FlipCoinCommand : DiscordCommand {
|
||||
|
||||
private readonly Random rng = new Random();
|
||||
|
||||
@ -34,11 +35,13 @@ namespace NadekoBot.Commands {
|
||||
}
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("$flip")
|
||||
.Description("Flips coin(s) - heads or tails, and shows an image.\n**Usage**: `$flip` or `$flip 3`")
|
||||
.Parameter("count", ParameterType.Optional)
|
||||
.Do(DoFunc());
|
||||
}
|
||||
|
||||
public FlipCoinCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,10 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class HelpCommand : IDiscordCommand {
|
||||
internal class HelpCommand : DiscordCommand {
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async e => {
|
||||
#region OldHelp
|
||||
/*
|
||||
@ -78,7 +79,7 @@ Version: `{NadekoStats.Instance.BotVersion}`";
|
||||
#endif
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("-h")
|
||||
.Alias(new string[] { "-help", NadekoBot.BotMention + " help", NadekoBot.BotMention + " h", "~h" })
|
||||
.Description("Either shows a help for a single command, or PMs you help link if no arguments are specified.\n**Usage**: '-h !m q' or just '-h' ")
|
||||
@ -119,5 +120,7 @@ You can join nadekobot server by simply private messaging NadekoBot, and you wil
|
||||
str += " **Description:** " + com.Description + "\n";
|
||||
return str;
|
||||
}
|
||||
|
||||
public HelpCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,31 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands
|
||||
{
|
||||
namespace NadekoBot.Commands {
|
||||
/// <summary>
|
||||
/// Base DiscordCommand Class.
|
||||
/// Inherit this class to create your own command.
|
||||
/// </summary>
|
||||
public interface IDiscordCommand
|
||||
{
|
||||
internal abstract class DiscordCommand {
|
||||
|
||||
/// <summary>
|
||||
/// Parent module
|
||||
/// </summary>
|
||||
protected DiscordModule Module { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of discord command,
|
||||
/// use ": base(module)" in the derived class'
|
||||
/// constructor to make sure module is assigned
|
||||
/// </summary>
|
||||
/// <param name="module">Module this command resides in</param>
|
||||
protected DiscordCommand(DiscordModule module) {
|
||||
this.Module = module;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the CommandBuilder with values using CommandGroupBuilder
|
||||
/// </summary>
|
||||
void Init(CommandGroupBuilder cgb);
|
||||
internal abstract void Init(CommandGroupBuilder cgb);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,11 @@ using Discord.Commands;
|
||||
using System.Drawing;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class LoLCommands : IDiscordCommand {
|
||||
internal class LoLCommands : DiscordCommand {
|
||||
|
||||
private class CachedChampion {
|
||||
public System.IO.Stream ImageStream { get; set; }
|
||||
@ -23,7 +24,7 @@ namespace NadekoBot.Commands {
|
||||
|
||||
|
||||
private System.Timers.Timer clearTimer { get; } = new System.Timers.Timer();
|
||||
public LoLCommands() {
|
||||
public LoLCommands(DiscordModule module) : base(module) {
|
||||
clearTimer.Interval = new TimeSpan(0, 10, 0).TotalMilliseconds;
|
||||
clearTimer.Start();
|
||||
clearTimer.Elapsed += (s, e) => {
|
||||
@ -55,7 +56,7 @@ namespace NadekoBot.Commands {
|
||||
public float StatScore { get; set; }
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("~lolchamp")
|
||||
.Description("Shows League Of Legends champion statistics. If there are spaces/apostrophes or in the name - omit them. Optional second parameter is a role.\n**Usage**:~lolchamp Riven or ~lolchamp Annie sup")
|
||||
.Parameter("champ", ParameterType.Required)
|
||||
|
@ -6,15 +6,16 @@ using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord;
|
||||
using NadekoBot.Classes.Permissions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class LogCommand : IDiscordCommand {
|
||||
internal class LogCommand : DiscordCommand {
|
||||
|
||||
private readonly ConcurrentDictionary<Server, Channel> logs = new ConcurrentDictionary<Server, Channel>();
|
||||
private readonly ConcurrentDictionary<Server, Channel> loggingPresences = new ConcurrentDictionary<Server, Channel>();
|
||||
private readonly ConcurrentDictionary<Channel, Channel> voiceChannelLog = new ConcurrentDictionary<Channel, Channel>();
|
||||
|
||||
public LogCommand() {
|
||||
public LogCommand(DiscordModule module) : base(module) {
|
||||
NadekoBot.Client.MessageReceived += MsgRecivd;
|
||||
NadekoBot.Client.MessageDeleted += MsgDltd;
|
||||
NadekoBot.Client.MessageUpdated += MsgUpdtd;
|
||||
@ -119,7 +120,7 @@ namespace NadekoBot.Commands {
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
|
||||
cgb.CreateCommand(".logserver")
|
||||
.Description("Toggles logging in this channel. Logs every message sent/deleted/edited on the server. BOT OWNER ONLY. SERVER OWNER ONLY.")
|
||||
|
@ -4,24 +4,24 @@ using System.Collections.Concurrent;
|
||||
using Discord;
|
||||
using NadekoBot.Classes.Permissions;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
class MessageRepeater : IDiscordCommand {
|
||||
class MessageRepeater : DiscordCommand {
|
||||
private readonly ConcurrentDictionary<Server, Repeater> repeaters = new ConcurrentDictionary<Server, Repeater>();
|
||||
private class Repeater {
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public readonly Timer MessageTimer;
|
||||
public Timer MessageTimer { get; set; }
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public Channel RepeatingChannel { get; }
|
||||
public Channel RepeatingChannel { get; set; }
|
||||
|
||||
public ulong RepeatingServerId { get; set; }
|
||||
public ulong RepeatingChannelId { get; set; }
|
||||
public string RepeatingMessage { get; set; }
|
||||
public int Interval { get; set; }
|
||||
|
||||
private Repeater(int interval) {
|
||||
this.Interval = interval;
|
||||
MessageTimer = new Timer {Interval = Interval};
|
||||
public Repeater Start() {
|
||||
MessageTimer = new Timer { Interval = Interval };
|
||||
MessageTimer.Elapsed += async (s, e) => {
|
||||
var ch = RepeatingChannel;
|
||||
var msg = RepeatingMessage;
|
||||
@ -31,19 +31,10 @@ namespace NadekoBot.Commands {
|
||||
} catch { }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Repeater(int interval, ulong channelId, ulong serverId) : this(interval) {
|
||||
this.RepeatingChannelId = channelId;
|
||||
this.RepeatingServerId = serverId;
|
||||
}
|
||||
|
||||
public Repeater(int interval, ulong channelId, ulong serverId, Channel channel)
|
||||
: this(interval,channelId,serverId) {
|
||||
this.RepeatingChannel = channel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
|
||||
cgb.CreateCommand(".repeat")
|
||||
.Description("Repeat a message every X minutes. If no parameters are specified, " +
|
||||
@ -71,7 +62,12 @@ namespace NadekoBot.Commands {
|
||||
|
||||
var repeater = repeaters.GetOrAdd(
|
||||
e.Server,
|
||||
s => new Repeater(minutes * 60 * 1000, e.Channel.Id, e.Server.Id, e.Channel)
|
||||
s => new Repeater {
|
||||
Interval = minutes * 60 * 1000,
|
||||
RepeatingChannel = e.Channel,
|
||||
RepeatingChannelId = e.Channel.Id,
|
||||
RepeatingServerId = e.Server.Id,
|
||||
}.Start()
|
||||
);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(msg))
|
||||
@ -85,5 +81,7 @@ namespace NadekoBot.Commands {
|
||||
repeater.RepeatingMessage, minutes, repeater.RepeatingChannel));
|
||||
});
|
||||
}
|
||||
|
||||
public MessageRepeater(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ using NadekoBot.Classes.JSONModels;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class PlayingRotate : IDiscordCommand {
|
||||
internal class PlayingRotate : DiscordCommand {
|
||||
private static readonly Timer timer = new Timer(12000);
|
||||
|
||||
public static Dictionary<string, Func<string>> PlayingPlaceholders { get; } =
|
||||
@ -72,7 +72,7 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage($"❗`Rotating playing status has been {(timer.Enabled ? "enabled" : "disabled")}.`");
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(".rotateplaying")
|
||||
.Alias(".ropl")
|
||||
.Description("Toggles rotation of playing status of the dynamic strings you specified earlier.")
|
||||
|
@ -6,9 +6,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class PollCommand : IDiscordCommand {
|
||||
internal class PollCommand : DiscordCommand {
|
||||
|
||||
public static ConcurrentDictionary<Server, Poll> ActivePolls = new ConcurrentDictionary<Server, Poll>();
|
||||
|
||||
@ -16,7 +17,7 @@ namespace NadekoBot.Commands {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(">poll")
|
||||
.Description("Creates a poll, only person who has manage server permission can do it.\n**Usage**: >poll Question?;Answer1;Answ 2;A_3")
|
||||
.Parameter("allargs", ParameterType.Unparsed)
|
||||
@ -49,6 +50,8 @@ namespace NadekoBot.Commands {
|
||||
await ActivePolls[e.Server].StopPoll(e.Channel);
|
||||
});
|
||||
}
|
||||
|
||||
public PollCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
|
||||
internal class Poll {
|
||||
|
@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class RatelimitCommand : IDiscordCommand {
|
||||
internal class RatelimitCommand : DiscordCommand {
|
||||
|
||||
public static ConcurrentDictionary<ulong, ConcurrentDictionary<ulong, DateTime>> RatelimitingChannels = new ConcurrentDictionary<ulong, ConcurrentDictionary<ulong, DateTime>>();
|
||||
|
||||
private static readonly TimeSpan ratelimitTime = new TimeSpan(0, 0, 0, 5);
|
||||
|
||||
public RatelimitCommand() {
|
||||
public RatelimitCommand(DiscordModule module) : base(module) {
|
||||
NadekoBot.Client.MessageReceived += async (s, e) => {
|
||||
if (e.Channel.IsPrivate)
|
||||
return;
|
||||
@ -28,7 +29,7 @@ namespace NadekoBot.Commands {
|
||||
};
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(".slowmode")
|
||||
.Description("Toggles slow mode. When ON, users will be able to send only 1 message every 5 seconds.")
|
||||
.Parameter("minutes", ParameterType.Optional)
|
||||
|
@ -2,9 +2,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class RequestsCommand : IDiscordCommand {
|
||||
internal class RequestsCommand : DiscordCommand {
|
||||
public void SaveRequest(CommandEventArgs e, string text) {
|
||||
Classes.DbHandler.Instance.InsertData(new Classes._DataModels.Request {
|
||||
RequestText = text,
|
||||
@ -37,7 +38,7 @@ namespace NadekoBot.Commands {
|
||||
public Classes._DataModels.Request ResolveRequest(int requestNumber) =>
|
||||
Classes.DbHandler.Instance.Delete<Classes._DataModels.Request>(requestNumber);
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
|
||||
cgb.CreateCommand("req")
|
||||
.Alias("request")
|
||||
@ -101,5 +102,7 @@ namespace NadekoBot.Commands {
|
||||
} else await e.Channel.SendMessage("You don't have permission to do that.");
|
||||
});
|
||||
}
|
||||
|
||||
public RequestsCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using Discord.Commands;
|
||||
using System.Collections.Concurrent;
|
||||
using NadekoBot.Extensions;
|
||||
using Discord;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
/* Voltana's legacy
|
||||
public class AsyncLazy<T> : Lazy<Task<T>>
|
||||
@ -21,13 +22,13 @@ public class AsyncLazy<T> : Lazy<Task<T>>
|
||||
*/
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class ServerGreetCommand : IDiscordCommand {
|
||||
internal class ServerGreetCommand : DiscordCommand {
|
||||
|
||||
public static ConcurrentDictionary<ulong, AnnounceControls> AnnouncementsDictionary;
|
||||
|
||||
public static long Greeted = 0;
|
||||
|
||||
public ServerGreetCommand() {
|
||||
public ServerGreetCommand(DiscordModule module) : base(module) {
|
||||
AnnouncementsDictionary = new ConcurrentDictionary<ulong, AnnounceControls>();
|
||||
|
||||
NadekoBot.Client.UserJoined += UserJoined;
|
||||
@ -172,7 +173,7 @@ namespace NadekoBot.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
|
||||
cgb.CreateCommand(".greet")
|
||||
.Description("Enables or Disables anouncements on the current channel when someone joins the server.")
|
||||
|
@ -9,6 +9,7 @@ using Discord.Commands;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
|
||||
@ -107,11 +108,11 @@ namespace NadekoBot.Commands {
|
||||
|
||||
}
|
||||
|
||||
internal class SpeedTyping : IDiscordCommand {
|
||||
internal class SpeedTyping : DiscordCommand {
|
||||
|
||||
public static ConcurrentDictionary<ulong, TypingGame> RunningContests;
|
||||
|
||||
public SpeedTyping() {
|
||||
public SpeedTyping(DiscordModule module) : base(module) {
|
||||
RunningContests = new ConcurrentDictionary<ulong, TypingGame>();
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage("No contest to stop on this channel.");
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("typestart")
|
||||
.Description("Starts a typing contest.")
|
||||
.Do(DoFunc());
|
||||
|
@ -3,10 +3,11 @@ using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using System.Collections.Concurrent;
|
||||
using Discord;
|
||||
using NadekoBot.Modules;
|
||||
using TriviaGame = NadekoBot.Classes.Trivia.TriviaGame;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class Trivia : IDiscordCommand {
|
||||
internal class Trivia : DiscordCommand {
|
||||
public static ConcurrentDictionary<ulong, TriviaGame> RunningTrivias = new ConcurrentDictionary<ulong, TriviaGame>();
|
||||
|
||||
public Func<CommandEventArgs, Task> DoFunc() => async e => {
|
||||
@ -21,7 +22,7 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage("Trivia game is already running on this server.\n" + trivia.CurrentQuestion);
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand("t")
|
||||
.Description("Starts a game of trivia.")
|
||||
.Alias("-t")
|
||||
@ -51,5 +52,7 @@ namespace NadekoBot.Commands {
|
||||
await e.Channel.SendMessage("No trivia is running on this server.");
|
||||
});
|
||||
}
|
||||
|
||||
public Trivia(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,10 @@ using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using System.Collections.Concurrent;
|
||||
using Discord;
|
||||
using NadekoBot.Modules;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
internal class VoiceNotificationCommand : IDiscordCommand {
|
||||
internal class VoiceNotificationCommand : DiscordCommand {
|
||||
|
||||
//voicechannel/text channel
|
||||
private readonly ConcurrentDictionary<Channel, Channel> subscribers = new ConcurrentDictionary<Channel, Channel>();
|
||||
@ -27,7 +28,7 @@ namespace NadekoBot.Commands {
|
||||
}
|
||||
};
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
/*
|
||||
cgb.CreateCommand(".voicenotif")
|
||||
.Description("Enables notifications on who joined/left the voice channel.\n**Usage**:.voicenotif Karaoke club")
|
||||
@ -35,5 +36,7 @@ namespace NadekoBot.Commands {
|
||||
.Do(DoFunc());
|
||||
*/
|
||||
}
|
||||
|
||||
public VoiceNotificationCommand(DiscordModule module) : base(module) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes.Permissions;
|
||||
using NadekoBot.Modules;
|
||||
using ChPermOverride = Discord.ChannelPermissionOverrides;
|
||||
|
||||
namespace NadekoBot.Commands {
|
||||
@ -18,9 +16,9 @@ namespace NadekoBot.Commands {
|
||||
/// You can check out his server here: https://discord.gg/0ZgChoTkuxAzARfF
|
||||
/// sowwy googie ;(
|
||||
/// </summary>
|
||||
internal class VoicePlusTextCommand : IDiscordCommand {
|
||||
internal class VoicePlusTextCommand : DiscordCommand {
|
||||
|
||||
public VoicePlusTextCommand() {
|
||||
public VoicePlusTextCommand(DiscordModule module) : base(module) {
|
||||
// changing servers may cause bugs
|
||||
NadekoBot.Client.UserUpdated += async (sender, e) => {
|
||||
try {
|
||||
@ -60,7 +58,7 @@ namespace NadekoBot.Commands {
|
||||
};
|
||||
}
|
||||
|
||||
public void Init(CommandGroupBuilder cgb) {
|
||||
internal override void Init(CommandGroupBuilder cgb) {
|
||||
cgb.CreateCommand(".v+t")
|
||||
.Alias(".voice+text")
|
||||
.Description("Creates a text channel for each voice channel only users in that voice channel can see." +
|
||||
|
@ -4,7 +4,7 @@ using NadekoBot.Commands;
|
||||
|
||||
namespace NadekoBot.Modules {
|
||||
internal abstract class DiscordModule : IModule {
|
||||
protected readonly HashSet<IDiscordCommand> commands = new HashSet<IDiscordCommand>();
|
||||
protected readonly HashSet<DiscordCommand> commands = new HashSet<DiscordCommand>();
|
||||
|
||||
public abstract string Prefix { get; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user