public async Task Seen(CommandContext ctx, string userName) { logger.Info("Seen Command", Useful.GetDiscordName(ctx)); string message = Commands.Seen.CheckSeen(userName); await ctx.Message.RespondAsync(message).ConfigureAwait(false); }
public async Task RKill(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "RKill Command"); string args; string author = ctx.Member.DisplayName; List <string> listU = Useful.GetOnlineNames(ctx.Channel.Guild); try { args = ctx.Message.Content.Split(new char[] { ' ' }, 2)[1]; } catch (IndexOutOfRangeException) { args = string.Empty; } KillUser.KillResult result = KillUser.KillRandom(args, author, listU); switch (result.IsAction) { case true: await ctx.RespondAsync("*" + result.Result.Trim() + "*").ConfigureAwait(false); break; case false: await ctx.RespondAsync(result.Result).ConfigureAwait(false); break; } }
public async Task Funk(CommandContext ctx) { logger.Info("Funk Command", Useful.GetDiscordName(ctx)); await ctx.Message.RespondAsync(Commands.Funk.PrintFunk()).ConfigureAwait(false); }
[Aliases("p")] // alternative names for the command public async Task Ping(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "ping Command"); string msg, cmd, args; try { msg = ctx.Message.Content.ToLower(CultureInfo.CreateSpecificCulture("en-GB")).Split(new char[] { ' ' }, 2)[1]; // remove !p or !ping cmd = msg.Split(new char[] { ' ' }, 2)[0]; // get command word args = Useful.GetBetween(msg, cmd + " ", null); // get words after command, add a space to cmd word so args doesnt start with one } catch (IndexOutOfRangeException) { return; } if (!string.IsNullOrWhiteSpace(msg)) { ulong userNameID = ctx.Member.Id; // get message creators username in lower case var discordUser = ctx.Message.Author; await PingUser.PingControl(userNameID, discordUser, cmd, args).ConfigureAwait(false); PingUser.SavePings(PingUser.Pings); } }
public async Task SquareText(CommandContext ctx, [RemainingText] string args) { logger.Info("Square Command", Useful.GetDiscordName(ctx)); string message = Square.SquareText(args, Useful.GetUsername(ctx)); await ctx.RespondAsync(message).ConfigureAwait(false); }
public async Task Fortune(CommandContext ctx) { logger.Info("Fortune Command", Useful.GetDiscordName(ctx)); string message = Commands.Fortune.GetFortune(ctx.User.Id); await ctx.Message.RespondAsync(message).ConfigureAwait(false); }
public async Task Poke(CommandContext ctx, params string[] names) { logger.Info("Poke Command", Useful.GetDiscordName(ctx)); string result = Basics.PokeRandom(Useful.GetOnlineNames(ctx.Channel.Guild), Useful.GetUsername(ctx)); await ctx.RespondAsync(result).ConfigureAwait(false); }
public async Task Fact(CommandContext ctx, [RemainingText] string args) { logger.Info("Fact Command", Useful.GetDiscordName(ctx)); string result = Commands.Fact.ShowFact(args, Useful.GetOnlineNames(ctx.Channel.Guild), Useful.GetUsername(ctx)); await ctx.Message.RespondAsync(result).ConfigureAwait(false); }
public async Task Nick(CommandContext ctx, [RemainingText] string args) { logger.Info("Nick Command", Useful.GetDiscordName(ctx)); string result = Commands.Nick.NickGen(args, Useful.GetUsername(ctx)); await ctx.RespondAsync(result).ConfigureAwait(false); }
public async Task EventUnsubscribe(CommandContext ctx, [RemainingText] string eventName) { logger.Info("Event Unsubscribe Command", Useful.GetDiscordName(ctx)); bool result = NotifyEventManager.UnsubscribeUserToEvent(ctx.User.Id, ctx.Guild.Id, eventName); string message = result ? "Removed sucessfully from " + eventName : "Error"; await ctx.Message.RespondAsync(message).ConfigureAwait(false); }
public async Task FunkAsync(CommandContext ctx, [RemainingText] string args) { logger.Info("Funk Command Add", Useful.GetDiscordName(ctx)); if (!string.IsNullOrEmpty(args)) { Commands.Funk.AddFunk(args); await ctx.Message.RespondAsync("Funk Added").ConfigureAwait(false); } }
public async Task Poke(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "Poke Command"); List <string> listU = Useful.GetOnlineNames(ctx.Channel.Guild); string user = ctx.Member.DisplayName; string result = Basics.PokeRandom(listU, user); await ctx.RespondAsync(result).ConfigureAwait(false); }
public async Task QuoteAdd(CommandContext ctx, [RemainingText] string arg) { logger.Info("Quote Add Command", Useful.GetDiscordName(ctx)); if (!string.IsNullOrWhiteSpace(arg)) { Quotes.AddQuote(arg); await ctx.RespondAsync("Quote added").ConfigureAwait(false); } }
public async Task Shuffle(CommandContext ctx, [RemainingText] string args) { logger.Info("Shuffle Command", Useful.GetDiscordName(ctx)); string result = Basics.Shuffle(args); if (!string.IsNullOrWhiteSpace(result)) { await ctx.RespondAsync(result).ConfigureAwait(false); } }
public async Task Trivia(CommandContext ctx) { logger.Info("Trivia Command", Useful.GetDiscordName(ctx)); try { await ctx.Message.RespondAsync(Commands.Trivia.GetTrivia()).ConfigureAwait(false); } catch (Exception ex) { logger.Error(ex.Message, Useful.GetDiscordName(ctx)); } }
[Description("Show or add quotes. Add argument \"add\" after the command to add quote. If a different argument is used it will perform a search. If no arguments are shown, a random quote is shown")] // this will be displayed to tell users what this command does when they invoke help public async Task Quote(CommandContext ctx, [RemainingText] string arg) { logger.Info("Quote Command", Useful.GetDiscordName(ctx)); if (arg != null && string.Compare(arg.Split(new char[] { ' ' }, 2)[0], "add", StringComparison.OrdinalIgnoreCase) == 0) // add { Quotes.AddQuote(arg); await ctx.RespondAsync("Quote added").ConfigureAwait(false); } else // lookup or random { await ctx.RespondAsync(Quotes.PrintQuote(arg)).ConfigureAwait(false); } }
public async Task YoutubeSearch(CommandContext ctx, [RemainingText] string args) { logger.Info("Youtube Command", Useful.GetDiscordName(ctx)); try { string result = Youtube.YoutubeSearch(args); await ctx.Message.RespondAsync(result).ConfigureAwait(false); } catch (IndexOutOfRangeException) { return; } }
public async Task Choose(CommandContext ctx, [RemainingText] string args) { logger.Info("Choose Command", Useful.GetDiscordName(ctx)); try { string arg = args.Trim().Replace(" ", " ", StringComparison.OrdinalIgnoreCase); string result = Basics.Choose(arg, Useful.GetUsername(ctx)); await ctx.RespondAsync(result).ConfigureAwait(false); } catch (IndexOutOfRangeException) { return; } }
public async Task RemoveCustomCommand(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "removecmd Command"); string[] splits; splits = ctx.Message.Content.Split(new char[] { ' ' }, 3); if (Useful.MemberIsBotOperator(ctx.Member) || ctx.Member.IsOwner) { CustomCommand.RemoveCommandByName(splits[1], CustomCommand.CustomCommands); CustomCommand.SaveCustomCommands(CustomCommand.CustomCommands); string message = "Command " + splits[1] + " removed."; await ctx.RespondAsync(message).ConfigureAwait(false); } }
public async Task EventDisable(CommandContext ctx, [RemainingText] string eventName) { logger.Info("Event Disable Command", Useful.GetDiscordName(ctx)); try { NotifyEventManager.DisableEvent(eventName); await ctx.Message.RespondAsync("Disabled " + eventName + " sucessfully").ConfigureAwait(false); } catch (ArgumentException ex) { await ctx.Message.RespondAsync("Error, event probably not found").ConfigureAwait(false); logger.Error("Error disabling event: " + ex.Message, Useful.GetDiscordName(ctx)); } }
public async Task RemoveCustomCommand(CommandContext ctx, string commandName) { logger.Info("removecmd Command", Useful.GetDiscordName(ctx)); if (Useful.MemberIsBotOperator(ctx.Member) || ctx.Member.IsOwner) { if (CustomCommand.RemoveCommandByName(commandName)) { CustomCommand.SaveCustomCommands(); await ctx.RespondAsync("Command " + commandName + " removed.").ConfigureAwait(false); } else { await ctx.RespondAsync("Command " + commandName + " not found.").ConfigureAwait(false); } } }
public async Task AddCustomCommand(CommandContext ctx, string commandName, [RemainingText] string format) { logger.Info("addcmd Command", Useful.GetDiscordName(ctx)); if (CustomCommand.CommandExists(commandName) == true) { string message = "Command " + commandName + " already exists."; await ctx.RespondAsync(message).ConfigureAwait(false); } if (string.IsNullOrWhiteSpace(format)) { return; } CustomCommand.CustomCommands.Add(new CustomCommand(ctx.User.Username, commandName, format)); CustomCommand.SaveCustomCommands(); }
public async Task EventDelete(CommandContext ctx, [RemainingText] string eventName) { logger.Info("Remove Event Command", Useful.GetDiscordName(ctx)); string message; try { NotifyEventManager.RemoveEvent(eventName); message = "Event Removed."; } catch (Exception ex) { message = "Event not removed. Error: " + ex.Message; } await ctx.Message.RespondAsync(message).ConfigureAwait(false); }
public async Task EventCreate(CommandContext ctx, [RemainingText] string args) { logger.Info("Create Event Command", Useful.GetDiscordName(ctx)); string message; try { NotifyEventManager.AddEvent(args); message = "Event added. Now activate it manually"; } catch (Exception ex) { message = "Event not created, error: " + ex.Message; } await ctx.Message.RespondAsync(message).ConfigureAwait(false); }
public async Task RandomKill(CommandContext ctx) { logger.Info("rkill Command", Useful.GetDiscordName(ctx)); KillUser.KillResult result = KillUser.KillRandom(Useful.GetUsername(ctx), Useful.GetOnlineNames(ctx.Channel.Guild)); switch (result.IsAction) { case true: await ctx.RespondAsync("*" + result.Result.Trim() + "*").ConfigureAwait(false); break; case false: await ctx.RespondAsync(result.Result).ConfigureAwait(false); break; } }
public async Task Roll(CommandContext ctx, int max) { logger.Info("Roll Command", Useful.GetDiscordName(ctx)); try { int number = Basics.Roll(max); string message = Useful.GetUsername(ctx) + " rolled a " + number; await ctx.RespondAsync(message).ConfigureAwait(false); } catch (FormatException) { await ctx.RespondAsync("Wrong Format").ConfigureAwait(false); } catch (OverflowException) { await ctx.RespondAsync("Number too large").ConfigureAwait(false); } }
public async Task Kill(CommandContext ctx, [RemainingText] string arg) { logger.Info("Kill Command", Useful.GetDiscordName(ctx)); KillUser.KillResult result = KillUser.Kill(Useful.GetUsername(ctx), Useful.GetOnlineNames(ctx.Channel.Guild), arg); switch (result.IsAction) { case true: await ctx.RespondAsync("*" + result.Result + "*").ConfigureAwait(false); break; case false: await ctx.RespondAsync(result.Result).ConfigureAwait(false); break; } }
public async Task Fact(CommandContext ctx) { Console.WriteLine(DateTime.Now.ToString("[HH:mm:ss] ", CultureInfo.CreateSpecificCulture("en-GB")) + "Fact Command"); List <string> listU = Useful.GetOnlineNames(ctx.Channel.Guild); string user = ctx.Member.DisplayName; string args; try { args = ctx.Message.Content.Split(new char[] { ' ' }, 2)[1]; } catch (IndexOutOfRangeException) { args = string.Empty; } string result = Commands.Fact.ShowFact(args, listU, user); await ctx.Message.RespondAsync(result).ConfigureAwait(false); }
public async Task Ping(CommandContext ctx, string cmd, [RemainingText] string args) { logger.Info("ping Command", Useful.GetDiscordName(ctx)); switch (cmd) { case "add": PingUser.PingControlAdd(ctx.Member.Id, args); break; case "remove": PingUser.PingControlRemove(ctx.Member.Id, args); break; case "info": if (ctx.Guild.Members.TryGetValue(ctx.Message.Author.Id, out DiscordMember member)) { await PingUser.PingControlInfo(member).ConfigureAwait(false); } break; } PingUser.SavePings(PingUser.Pings); }
public async Task EventList(CommandContext ctx, [RemainingText] string args) { logger.Info("List Event Command", Useful.GetDiscordName(ctx)); if (NotifyEventManager.NotifyEventCount() == 0) { await ctx.Message.RespondAsync("No Events saved").ConfigureAwait(false); return; } string[] events = NotifyEventManager.getNotifyEventDetails(!string.IsNullOrWhiteSpace(args) && args.Trim().ToLower() == "extra"); StringBuilder builder = new StringBuilder().Append("```"); foreach (string eventDetail in events) { builder.AppendLine(eventDetail); } builder.Append("```"); await ctx.Message.RespondAsync(builder.ToString()).ConfigureAwait(false); }