$take and $award bot owner commands added. ref #163
This commit is contained in:
parent
f80b20d6d6
commit
1ff54fee2e
@ -33,9 +33,11 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
.Description("Prints a name and ID of a random user from the online list from the (optional) role.")
|
.Description("Prints a name and ID of a random user from the online list from the (optional) role.")
|
||||||
.Parameter("role", ParameterType.Optional)
|
.Parameter("role", ParameterType.Optional)
|
||||||
.Do(RaffleFunc());
|
.Do(RaffleFunc());
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "$$")
|
cgb.CreateCommand(Prefix + "$$")
|
||||||
.Description(string.Format("Check how much {0}s you have.", NadekoBot.Config.CurrencyName))
|
.Description(string.Format("Check how much {0}s you have.", NadekoBot.Config.CurrencyName))
|
||||||
.Do(NadekoFlowerCheckFunc());
|
.Do(NadekoFlowerCheckFunc());
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "give")
|
cgb.CreateCommand(Prefix + "give")
|
||||||
.Description(string.Format("Give someone a certain amount of {0}s", NadekoBot.Config.CurrencyName))
|
.Description(string.Format("Give someone a certain amount of {0}s", NadekoBot.Config.CurrencyName))
|
||||||
.Parameter("amount", ParameterType.Required)
|
.Parameter("amount", ParameterType.Required)
|
||||||
@ -67,6 +69,50 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
await e.Channel.SendMessage($"{e.User.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {mentionedUser.Mention}!");
|
await e.Channel.SendMessage($"{e.User.Mention} successfully sent {amount} {NadekoBot.Config.CurrencyName}s to {mentionedUser.Mention}!");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand(Prefix + "award")
|
||||||
|
.Description("Gives someone a certain amount of flowers. **Owner only!**")
|
||||||
|
.AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
|
||||||
|
.Parameter("amount", ParameterType.Required)
|
||||||
|
.Parameter("receiver", ParameterType.Unparsed)
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var amountStr = e.GetArg("amount")?.Trim();
|
||||||
|
long amount;
|
||||||
|
if (!long.TryParse(amountStr, out amount) || amount < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u =>
|
||||||
|
u.Id != NadekoBot.Client.CurrentUser.Id);
|
||||||
|
if (mentionedUser == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await FlowersHandler.AddFlowersAsync(mentionedUser, $"Awarded by bot owner. ({e.User.Name}/{e.User.Id})", (int)amount);
|
||||||
|
|
||||||
|
await e.Channel.SendMessage($"{e.User.Mention} successfully awarded {amount} {NadekoBot.Config.CurrencyName}s to {mentionedUser.Mention}!");
|
||||||
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand(Prefix + "take")
|
||||||
|
.Description("Takes a certain amount of flowers from someone. **Owner only!**")
|
||||||
|
.AddCheck(Classes.Permissions.SimpleCheckers.OwnerOnly())
|
||||||
|
.Parameter("amount", ParameterType.Required)
|
||||||
|
.Parameter("rektperson", ParameterType.Unparsed)
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var amountStr = e.GetArg("amount")?.Trim();
|
||||||
|
long amount;
|
||||||
|
if (!long.TryParse(amountStr, out amount) || amount < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var mentionedUser = e.Message.MentionedUsers.FirstOrDefault(u =>
|
||||||
|
u.Id != NadekoBot.Client.CurrentUser.Id);
|
||||||
|
if (mentionedUser == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await FlowersHandler.RemoveFlowersAsync(mentionedUser, $"Taken by bot owner.({e.User.Name}/{e.User.Id})", (int)amount);
|
||||||
|
|
||||||
|
await e.Channel.SendMessage($"{e.User.Mention} successfully took {amount} {NadekoBot.Config.CurrencyName}s from {mentionedUser.Mention}!");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
using System;
|
using Discord.Commands;
|
||||||
using System.Linq;
|
|
||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using NadekoBot.Commands;
|
using NadekoBot.Commands;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using Discord.Commands;
|
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace NadekoBot.Modules {
|
namespace NadekoBot.Modules
|
||||||
internal class Games : DiscordModule {
|
{
|
||||||
|
internal class Games : DiscordModule
|
||||||
|
{
|
||||||
private readonly Random rng = new Random();
|
private readonly Random rng = new Random();
|
||||||
|
|
||||||
public Games() {
|
public Games()
|
||||||
|
{
|
||||||
commands.Add(new Trivia(this));
|
commands.Add(new Trivia(this));
|
||||||
commands.Add(new SpeedTyping(this));
|
commands.Add(new SpeedTyping(this));
|
||||||
commands.Add(new PollCommand(this));
|
commands.Add(new PollCommand(this));
|
||||||
@ -21,8 +22,10 @@ namespace NadekoBot.Modules {
|
|||||||
|
|
||||||
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Games;
|
public override string Prefix { get; } = NadekoBot.Config.CommandPrefixes.Games;
|
||||||
|
|
||||||
public override void Install(ModuleManager manager) {
|
public override void Install(ModuleManager manager)
|
||||||
manager.CreateCommands("", cgb => {
|
{
|
||||||
|
manager.CreateCommands("", cgb =>
|
||||||
|
{
|
||||||
|
|
||||||
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
|
||||||
|
|
||||||
@ -30,8 +33,9 @@ namespace NadekoBot.Modules {
|
|||||||
|
|
||||||
cgb.CreateCommand(Prefix + "choose")
|
cgb.CreateCommand(Prefix + "choose")
|
||||||
.Description("Chooses a thing from a list of things\n**Usage**: >choose Get up;Sleep;Sleep more")
|
.Description("Chooses a thing from a list of things\n**Usage**: >choose Get up;Sleep;Sleep more")
|
||||||
.Parameter("list", Discord.Commands.ParameterType.Unparsed)
|
.Parameter("list", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
var arg = e.GetArg("list");
|
var arg = e.GetArg("list");
|
||||||
if (string.IsNullOrWhiteSpace(arg))
|
if (string.IsNullOrWhiteSpace(arg))
|
||||||
return;
|
return;
|
||||||
@ -43,24 +47,29 @@ namespace NadekoBot.Modules {
|
|||||||
|
|
||||||
cgb.CreateCommand(Prefix + "8ball")
|
cgb.CreateCommand(Prefix + "8ball")
|
||||||
.Description("Ask the 8ball a yes/no question.")
|
.Description("Ask the 8ball a yes/no question.")
|
||||||
.Parameter("question", Discord.Commands.ParameterType.Unparsed)
|
.Parameter("question", ParameterType.Unparsed)
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
var question = e.GetArg("question");
|
var question = e.GetArg("question");
|
||||||
if (string.IsNullOrWhiteSpace(question))
|
if (string.IsNullOrWhiteSpace(question))
|
||||||
return;
|
return;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
await e.Channel.SendMessage(
|
await e.Channel.SendMessage(
|
||||||
$":question: **Question**: `{question}` \n🎱 **8Ball Answers**: `{NadekoBot.Config._8BallResponses[rng.Next(0, NadekoBot.Config._8BallResponses.Length)]}`");
|
$":question: **Question**: `{question}` \n🎱 **8Ball Answers**: `{NadekoBot.Config._8BallResponses[rng.Next(0, NadekoBot.Config._8BallResponses.Length)]}`");
|
||||||
} catch { }
|
}
|
||||||
|
catch { }
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(Prefix + "rps")
|
cgb.CreateCommand(Prefix + "rps")
|
||||||
.Description("Play a game of rocket paperclip scissors with nadkeo.\n**Usage**: >rps scissors")
|
.Description("Play a game of rocket paperclip scissors with Nadeko.\n**Usage**: >rps scissors")
|
||||||
.Parameter("input", ParameterType.Required)
|
.Parameter("input", ParameterType.Required)
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
var input = e.GetArg("input").Trim();
|
var input = e.GetArg("input").Trim();
|
||||||
int pick;
|
int pick;
|
||||||
switch (input) {
|
switch (input)
|
||||||
|
{
|
||||||
case "r":
|
case "r":
|
||||||
case "rock":
|
case "rock":
|
||||||
case "rocket":
|
case "rocket":
|
||||||
@ -96,7 +105,8 @@ namespace NadekoBot.Modules {
|
|||||||
.Description("Prints a customizable Linux interjection")
|
.Description("Prints a customizable Linux interjection")
|
||||||
.Parameter("gnu", ParameterType.Required)
|
.Parameter("gnu", ParameterType.Required)
|
||||||
.Parameter("linux", ParameterType.Required)
|
.Parameter("linux", ParameterType.Required)
|
||||||
.Do(async e => {
|
.Do(async e =>
|
||||||
|
{
|
||||||
var guhnoo = e.Args[0];
|
var guhnoo = e.Args[0];
|
||||||
var loonix = e.Args[1];
|
var loonix = e.Args[1];
|
||||||
|
|
||||||
@ -112,7 +122,8 @@ There really is a {loonix}, and these people are using it, but it is just a part
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetRPSPick(int i) {
|
private string GetRPSPick(int i)
|
||||||
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return "rocket";
|
return "rocket";
|
||||||
else if (i == 1)
|
else if (i == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user