fixed bot mention... api changed >.<

This commit is contained in:
Master Kwoth 2015-12-06 14:22:30 +01:00
parent 18213b6634
commit 203bbd40cc
3 changed files with 32 additions and 21 deletions

View File

@ -1,4 +1,5 @@
using Discord.Modules; using Discord.Modules;
using System.Linq;
namespace NadekoBot.Modules namespace NadekoBot.Modules
{ {
@ -12,7 +13,34 @@ namespace NadekoBot.Modules
{ {
manager.CreateCommands("", cgb => manager.CreateCommands("", cgb =>
{ {
commands.ForEach(com => com.Init(cgb)); var client = manager.Client;
commands.ForEach(cmd => cmd.Init(cgb));
cgb.CreateCommand(".uid")
.Description("Shows user id")
.Parameter("user",Discord.Commands.ParameterType.Required)
.Do(async e =>
{
if (e.Message.MentionedUsers.Any())
await client.SendMessage(e.Channel, "Id of the user " + e.Message.MentionedUsers.First().Mention + " is " + e.Message.MentionedUsers.First().Id);
else
await client.SendMessage(e.Channel, "You must mention a user.");
});
cgb.CreateCommand(".cid")
.Description("Shows current channel id")
.Do(async e =>
{
await client.SendMessage(e.Channel, "This channel's id is " + e.Channel.Id);
});
cgb.CreateCommand(".sid")
.Description("Shows current server id")
.Do(async e =>
{
await client.SendMessage(e.Channel, "This server's id is " + e.Server.Id);
});
}); });
} }

View File

@ -36,6 +36,7 @@ namespace NadekoBot.Modules
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
Random rng = new Random(); Random rng = new Random();
manager.CreateCommands("", cgb => manager.CreateCommands("", cgb =>
{ {
var client = manager.Client; var client = manager.Client;
@ -53,7 +54,6 @@ namespace NadekoBot.Modules
{ {
await client.SendMessage(e.Channel, Mention.User(e.User) + "\\o\\"); await client.SendMessage(e.Channel, Mention.User(e.User) + "\\o\\");
}); });
}); });
manager.CreateCommands(NadekoBot.botMention, cgb => manager.CreateCommands(NadekoBot.botMention, cgb =>
@ -71,7 +71,7 @@ namespace NadekoBot.Modules
else else
await client.SendMessage(e.Channel, Mention.User(e.User) + ", Don't be silly."); await client.SendMessage(e.Channel, Mention.User(e.User) + ", Don't be silly.");
}); });
CreateCommand(cgb, "die") CreateCommand(cgb, "die")
.Description("Works only for the owner. Shuts the bot down.") .Description("Works only for the owner. Shuts the bot down.")
.Do(async e => .Do(async e =>
@ -189,7 +189,6 @@ namespace NadekoBot.Modules
string str = "I am online for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes."; string str = "I am online for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
await client.SendMessage(e.Channel, str); await client.SendMessage(e.Channel, str);
}); });
CreateCommand(cgb, "fire") CreateCommand(cgb, "fire")
.Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\nUsage: @NadekoBot fire [x]") .Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\nUsage: @NadekoBot fire [x]")
.Parameter("times", ParameterType.Optional) .Parameter("times", ParameterType.Optional)
@ -469,20 +468,6 @@ namespace NadekoBot.Modules
{ {
await client.SendMessage(e.Channel, "Calling " + e.Args[0] + "..."); await client.SendMessage(e.Channel, "Calling " + e.Args[0] + "...");
}); });
cgb.CreateCommand("cid")
.Description("Shows current channel id")
.Do(async e =>
{
await client.SendMessage(e.Channel, "This channel's id is " + e.Channel.Id);
});
cgb.CreateCommand("sid")
.Description("Shows current server id")
.Do(async e =>
{
await client.SendMessage(e.Channel, "This server's id is " + e.Server.Id);
});
CreateCommand(cgb, "hide") CreateCommand(cgb, "hide")
.Description("Hides nadeko in plain sight!11!!") .Description("Hides nadeko in plain sight!11!!")
.Do(async e => .Do(async e =>

View File

@ -4,10 +4,8 @@ using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
using Discord.Commands; using Discord.Commands;
using Discord.Modules; using Discord.Modules;
using System.Text.RegularExpressions;
using Parse; using Parse;
using NadekoBot.Modules; using NadekoBot.Modules;
using System.Timers;
namespace NadekoBot namespace NadekoBot
{ {
@ -64,7 +62,7 @@ namespace NadekoBot
//install modules //install modules
modules.Install(new Administration(), "Administration", FilterType.Unrestricted); modules.Install(new Administration(), "Administration", FilterType.Unrestricted);
modules.Install(new Conversations(), "Conversation", FilterType.Unrestricted); modules.Install(new Conversations(), "Conversations", FilterType.Unrestricted);
modules.Install(new Gambling(), "Gambling", FilterType.Unrestricted); modules.Install(new Gambling(), "Gambling", FilterType.Unrestricted);
modules.Install(new Games(), "Games", FilterType.Unrestricted); modules.Install(new Games(), "Games", FilterType.Unrestricted);
modules.Install(new Music(), "Music", FilterType.Unrestricted); modules.Install(new Music(), "Music", FilterType.Unrestricted);