Add comeatmebro etc

This commit is contained in:
appelemac 2016-03-25 09:54:31 +01:00
parent aa589dbc05
commit ff039b8ee4

View File

@ -1,4 +1,4 @@
using Discord; using Discord;
using Discord.Commands; using Discord.Commands;
using Discord.Modules; using Discord.Modules;
using System; using System;
@ -14,28 +14,49 @@ using NadekoBot.Extensions;
using NadekoBot.Properties; using NadekoBot.Properties;
using NadekoBot.Commands; using NadekoBot.Commands;
namespace NadekoBot.Modules { namespace NadekoBot.Modules
internal class Conversations : DiscordModule { {
internal class Conversations : DiscordModule
{
private const string firestr = "🔥 ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้ 🔥"; private const string firestr = "🔥 ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้ 🔥";
public Conversations() { public Conversations()
{
commands.Add(new CopyCommand(this)); commands.Add(new CopyCommand(this));
commands.Add(new RequestsCommand(this)); commands.Add(new RequestsCommand(this));
} }
public override string Prefix { get; } = String.Format(NadekoBot.Config.CommandPrefixes.Conversations, NadekoBot.Creds.BotId); public override string Prefix { get; } = String.Format(NadekoBot.Config.CommandPrefixes.Conversations, NadekoBot.Creds.BotId);
public override void Install(ModuleManager manager) { public override void Install(ModuleManager manager)
{
var rng = new Random(); var rng = new Random();
manager.CreateCommands("", cgb => { manager.CreateCommands("", cgb =>
{
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
cgb.CreateCommand("e") cgb.CreateCommand("e")
.Description("You did it.") .Description("You did it.")
.Do(async e => { .Do(async e =>
{
await e.Channel.SendMessage($"{e.User.Name} did it. 😒 🔫"); await e.Channel.SendMessage($"{e.User.Name} did it. 😒 🔫");
}); });
cgb.CreateCommand("comeatmebro")
.Description("Come at me bro (ง’̀-‘́)ง \n**Usage**: comeatmebro {target}")
.Parameter("target", ParameterType.Optional)
.Do(async e =>
{
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
if (usr == null)
{
await e.Channel.SendMessage("(ง’̀-‘́)ง");
return;
}
await e.Channel.SendMessage($"{usr.Mention} (ง’̀-‘́)ง");
});
cgb.CreateCommand("\\o\\") cgb.CreateCommand("\\o\\")
.Description("Nadeko replies with /o/") .Description("Nadeko replies with /o/")
.Do(async e => await e.Channel.SendMessage(e.User.Mention + "/o/")); .Do(async e => await e.Channel.SendMessage(e.User.Mention + "/o/"));
@ -44,16 +65,27 @@ namespace NadekoBot.Modules {
.Description("Nadeko replies with \\o\\") .Description("Nadeko replies with \\o\\")
.Do(async e => await e.Channel.SendMessage(e.User.Mention + "\\o\\")); .Do(async e => await e.Channel.SendMessage(e.User.Mention + "\\o\\"));
cgb.CreateCommand("moveto")
.Description("Suggests moving the conversation.\n**Usage**: moveto #spam")
.Parameter("target", ParameterType.Unparsed)
.Do(async e =>
{
await e.Channel.SendMessage($"(👉 ͡° ͜ʖ ͡°)👉 {e.GetArg("target")}");
});
cgb.CreateCommand("..") cgb.CreateCommand("..")
.Description("Adds a new quote with the specified name (single word) and message (no limit).\n**Usage**: .. abc My message") .Description("Adds a new quote with the specified name (single word) and message (no limit).\n**Usage**: .. abc My message")
.Parameter("keyword", ParameterType.Required) .Parameter("keyword", ParameterType.Required)
.Parameter("text", ParameterType.Unparsed) .Parameter("text", ParameterType.Unparsed)
.Do(async e => { .Do(async e =>
{
var text = e.GetArg("text"); var text = e.GetArg("text");
if (string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(text))
return; return;
await Task.Run(() => await Task.Run(() =>
Classes.DbHandler.Instance.InsertData(new Classes._DataModels.UserQuote() { Classes.DbHandler.Instance.InsertData(new Classes._DataModels.UserQuote()
{
DateAdded = DateTime.Now, DateAdded = DateTime.Now,
Keyword = e.GetArg("keyword").ToLowerInvariant(), Keyword = e.GetArg("keyword").ToLowerInvariant(),
Text = text, Text = text,
@ -66,7 +98,8 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("...") cgb.CreateCommand("...")
.Description("Shows a random quote with a specified name.\n**Usage**: .. abc") .Description("Shows a random quote with a specified name.\n**Usage**: .. abc")
.Parameter("keyword", ParameterType.Required) .Parameter("keyword", ParameterType.Required)
.Do(async e => { .Do(async e =>
{
var keyword = e.GetArg("keyword")?.ToLowerInvariant(); var keyword = e.GetArg("keyword")?.ToLowerInvariant();
if (string.IsNullOrWhiteSpace(keyword)) if (string.IsNullOrWhiteSpace(keyword))
return; return;
@ -82,7 +115,8 @@ namespace NadekoBot.Modules {
}); });
}); });
manager.CreateCommands(NadekoBot.BotMention, cgb => { manager.CreateCommands(NadekoBot.BotMention, cgb =>
{
var client = manager.Client; var client = manager.Client;
cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance); cgb.AddCheck(Classes.Permissions.PermissionChecker.Instance);
@ -91,7 +125,8 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("uptime") cgb.CreateCommand("uptime")
.Description("Shows how long Nadeko has been running for.") .Description("Shows how long Nadeko has been running for.")
.Do(async e => { .Do(async e =>
{
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime); var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
var str = string.Format("I have been running for {0} days, {1} hours, and {2} minutes.", time.Days, time.Hours, time.Minutes); var str = string.Format("I have been running for {0} days, {1} hours, and {2} minutes.", time.Days, time.Hours, time.Minutes);
await e.Channel.SendMessage(str); await e.Channel.SendMessage(str);
@ -99,12 +134,15 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("die") cgb.CreateCommand("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 =>
if (NadekoBot.IsOwner(e.User.Id)) { {
if (NadekoBot.IsOwner(e.User.Id))
{
await e.Channel.SendMessage(e.User.Mention + ", Yes, my love."); await e.Channel.SendMessage(e.User.Mention + ", Yes, my love.");
await Task.Delay(5000); await Task.Delay(5000);
Environment.Exit(0); Environment.Exit(0);
} else }
else
await e.Channel.SendMessage(e.User.Mention + ", No."); await e.Channel.SendMessage(e.User.Mention + ", No.");
}); });
@ -113,7 +151,8 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("do you love me") cgb.CreateCommand("do you love me")
.Description("Replies with positive answer only to the bot owner.") .Description("Replies with positive answer only to the bot owner.")
.Do(async e => { .Do(async e =>
{
if (NadekoBot.IsOwner(e.User.Id)) if (NadekoBot.IsOwner(e.User.Id))
await e.Channel.SendMessage(e.User.Mention + ", Of course I do, my Master."); await e.Channel.SendMessage(e.User.Mention + ", Of course I do, my Master.");
else else
@ -122,15 +161,20 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("how are you") cgb.CreateCommand("how are you")
.Description("Replies positive only if bot owner is online.") .Description("Replies positive only if bot owner is online.")
.Do(async e => { .Do(async e =>
if (NadekoBot.IsOwner(e.User.Id)) { {
if (NadekoBot.IsOwner(e.User.Id))
{
await e.Channel.SendMessage(e.User.Mention + " I am great as long as you are here."); await e.Channel.SendMessage(e.User.Mention + " I am great as long as you are here.");
return; return;
} }
var kw = e.Server.GetUser(NadekoBot.Creds.OwnerIds[0]); var kw = e.Server.GetUser(NadekoBot.Creds.OwnerIds[0]);
if (kw != null && kw.Status == UserStatus.Online) { if (kw != null && kw.Status == UserStatus.Online)
{
await e.Channel.SendMessage(e.User.Mention + " I am great as long as " + kw.Mention + " is with me."); await e.Channel.SendMessage(e.User.Mention + " I am great as long as " + kw.Mention + " is with me.");
} else { }
else
{
await e.Channel.SendMessage(e.User.Mention + " I am sad. My Master is not with me."); await e.Channel.SendMessage(e.User.Mention + " I am sad. My Master is not with me.");
} }
}); });
@ -138,14 +182,17 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("insult") cgb.CreateCommand("insult")
.Parameter("mention", ParameterType.Required) .Parameter("mention", ParameterType.Required)
.Description("Insults @X person.\n**Usage**: @NadekoBot insult @X.") .Description("Insults @X person.\n**Usage**: @NadekoBot insult @X.")
.Do(async e => { .Do(async e =>
{
var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) { if (u == null)
{
await e.Channel.SendMessage("Invalid user specified."); await e.Channel.SendMessage("Invalid user specified.");
return; return;
} }
if (NadekoBot.IsOwner(u.Id)) { if (NadekoBot.IsOwner(u.Id))
{
await e.Channel.SendMessage("I would never insult my master <3"); await e.Channel.SendMessage("I would never insult my master <3");
return; return;
} }
@ -155,15 +202,18 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("praise") cgb.CreateCommand("praise")
.Description("Praises @X person.\n**Usage**: @NadekoBot praise @X.") .Description("Praises @X person.\n**Usage**: @NadekoBot praise @X.")
.Parameter("mention", ParameterType.Required) .Parameter("mention", ParameterType.Required)
.Do(async e => { .Do(async e =>
{
var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) { if (u == null)
{
await e.Channel.SendMessage("Invalid user specified."); await e.Channel.SendMessage("Invalid user specified.");
return; return;
} }
if (NadekoBot.IsOwner(u.Id)) { if (NadekoBot.IsOwner(u.Id))
{
await e.Channel.SendMessage(e.User.Mention + " I don't need your permission to praise my beloved Master <3"); await e.Channel.SendMessage(e.User.Mention + " I don't need your permission to praise my beloved Master <3");
return; return;
} }
@ -173,48 +223,61 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("pat") cgb.CreateCommand("pat")
.Description("Pat someone ^_^") .Description("Pat someone ^_^")
.Parameter("user", ParameterType.Unparsed) .Parameter("user", ParameterType.Unparsed)
.Do(async e => { .Do(async e =>
{
var userStr = e.GetArg("user"); var userStr = e.GetArg("user");
if (string.IsNullOrWhiteSpace(userStr) || !e.Message.MentionedUsers.Any()) return; if (string.IsNullOrWhiteSpace(userStr) || !e.Message.MentionedUsers.Any()) return;
var user = e.Server.FindUsers(userStr).FirstOrDefault(); var user = e.Server.FindUsers(userStr).FirstOrDefault();
if (user == null) if (user == null)
return; return;
try { try
{
await e.Channel.SendMessage( await e.Channel.SendMessage(
$"{user.Mention} " + $"{user.Mention} " +
$"{NadekoBot.Config.PatResponses[rng.Next(0, NadekoBot.Config.PatResponses.Length)]}"); $"{NadekoBot.Config.PatResponses[rng.Next(0, NadekoBot.Config.PatResponses.Length)]}");
} catch { }
catch
{
await e.Channel.SendMessage("Error while handling PatResponses check your data/config.json"); await e.Channel.SendMessage("Error while handling PatResponses check your data/config.json");
} }
}); });
cgb.CreateCommand("cry") cgb.CreateCommand("cry")
.Description("Tell Nadeko to cry. You are a heartless monster if you use this command.") .Description("Tell Nadeko to cry. You are a heartless monster if you use this command.")
.Do(async e => { .Do(async e =>
try { {
try
{
await await
e.Channel.SendMessage( e.Channel.SendMessage(
$"(•̥́ _•ૅ。)\n{NadekoBot.Config.CryResponses[rng.Next(0, NadekoBot.Config.CryResponses.Length)]}"); $"(•̥́ _•ૅ。)\n{NadekoBot.Config.CryResponses[rng.Next(0, NadekoBot.Config.CryResponses.Length)]}");
} catch { }
catch
{
await e.Channel.SendMessage("Error while handling CryResponses check your data/config.json"); await e.Channel.SendMessage("Error while handling CryResponses check your data/config.json");
} }
}); });
cgb.CreateCommand("disguise") cgb.CreateCommand("disguise")
.Description("Tell Nadeko to disguise herself.") .Description("Tell Nadeko to disguise herself.")
.Do(async e => { .Do(async e =>
try { {
try
{
await await
e.Channel.SendMessage( e.Channel.SendMessage(
$"{NadekoBot.Config.DisguiseResponses[rng.Next(0, NadekoBot.Config.DisguiseResponses.Length)]}"); $"{NadekoBot.Config.DisguiseResponses[rng.Next(0, NadekoBot.Config.DisguiseResponses.Length)]}");
} catch { }
catch
{
await e.Channel.SendMessage("Error while handling DisguiseResponses check your data/config.json"); await e.Channel.SendMessage("Error while handling DisguiseResponses check your data/config.json");
} }
}); });
cgb.CreateCommand("are you real") cgb.CreateCommand("are you real")
.Description("Useless.") .Description("Useless.")
.Do(async e => { .Do(async e =>
{
await e.Channel.SendMessage(e.User.Mention + " I will be soon."); await e.Channel.SendMessage(e.User.Mention + " I will be soon.");
}); });
@ -225,24 +288,28 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("draw") cgb.CreateCommand("draw")
.Description("Nadeko instructs you to type $draw. Gambling functions start with $") .Description("Nadeko instructs you to type $draw. Gambling functions start with $")
.Do(async e => { .Do(async e =>
{
await e.Channel.SendMessage("Sorry, I don't gamble, type $draw for that function."); await e.Channel.SendMessage("Sorry, I don't gamble, type $draw for that function.");
}); });
cgb.CreateCommand("fire") cgb.CreateCommand("fire")
.Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\n**Usage**: @NadekoBot fire [x]") .Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\n**Usage**: @NadekoBot fire [x]")
.Parameter("times", ParameterType.Optional) .Parameter("times", ParameterType.Optional)
.Do(async e => { .Do(async e =>
{
var count = 1; var count = 1;
int.TryParse(e.Args[0], out count); int.TryParse(e.Args[0], out count);
if (count == 0) if (count == 0)
count = 1; count = 1;
if (count < 1 || count > 12) { if (count < 1 || count > 12)
{
await e.Channel.SendMessage("Number must be between 0 and 12"); await e.Channel.SendMessage("Number must be between 0 and 12");
return; return;
} }
var str = ""; var str = "";
for (var i = 0; i < count; i++) { for (var i = 0; i < count; i++)
{
str += firestr; str += firestr;
} }
await e.Channel.SendMessage(str); await e.Channel.SendMessage(str);
@ -252,7 +319,8 @@ namespace NadekoBot.Modules {
.Description("Shows a grave image of someone with a start year\n**Usage**: @NadekoBot rip @Someone 2000") .Description("Shows a grave image of someone with a start year\n**Usage**: @NadekoBot rip @Someone 2000")
.Parameter("user", ParameterType.Required) .Parameter("user", ParameterType.Required)
.Parameter("year", ParameterType.Optional) .Parameter("year", ParameterType.Optional)
.Do(async e => { .Do(async e =>
{
if (string.IsNullOrWhiteSpace(e.GetArg("user"))) if (string.IsNullOrWhiteSpace(e.GetArg("user")))
return; return;
var usr = e.Channel.FindUsers(e.GetArg("user")).FirstOrDefault(); var usr = e.Channel.FindUsers(e.GetArg("user")).FirstOrDefault();
@ -262,16 +330,22 @@ namespace NadekoBot.Modules {
e.Channel.SendFile("ripzor_m8.png", e.Channel.SendFile("ripzor_m8.png",
RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year")) ? null : e.GetArg("year"))); RipName(text, string.IsNullOrWhiteSpace(e.GetArg("year")) ? null : e.GetArg("year")));
}); });
if (!NadekoBot.Config.DontJoinServers) { if (!NadekoBot.Config.DontJoinServers)
{
cgb.CreateCommand("j") cgb.CreateCommand("j")
.Description("Joins a server using a code.") .Description("Joins a server using a code.")
.Parameter("id", ParameterType.Required) .Parameter("id", ParameterType.Required)
.Do(async e => { .Do(async e =>
{
var invite = await client.GetInvite(e.Args[0]); var invite = await client.GetInvite(e.Args[0]);
if (invite != null) { if (invite != null)
try { {
try
{
await invite.Accept(); await invite.Accept();
} catch { }
catch
{
await e.Channel.SendMessage("Failed to accept invite."); await e.Channel.SendMessage("Failed to accept invite.");
} }
await e.Channel.SendMessage("I got in!"); await e.Channel.SendMessage("I got in!");
@ -283,7 +357,8 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("slm") cgb.CreateCommand("slm")
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)") .Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
.Do(async e => { .Do(async e =>
{
Message msg = null; Message msg = null;
var msgs = (await e.Channel.DownloadMessages(100)) var msgs = (await e.Channel.DownloadMessages(100))
@ -291,10 +366,12 @@ namespace NadekoBot.Modules {
.OrderByDescending(m => m.Timestamp); .OrderByDescending(m => m.Timestamp);
if (msgs.Any()) if (msgs.Any())
msg = msgs.First(); msg = msgs.First();
else { else
{
var attempt = 0; var attempt = 0;
Message lastMessage = null; Message lastMessage = null;
while (msg == null && attempt++ < 5) { while (msg == null && attempt++ < 5)
{
var msgsarr = await e.Channel.DownloadMessages(100, lastMessage?.Id); var msgsarr = await e.Channel.DownloadMessages(100, lastMessage?.Id);
msg = msgsarr msg = msgsarr
.Where(m => m.MentionedUsers.Contains(e.User)) .Where(m => m.MentionedUsers.Contains(e.User))
@ -312,9 +389,11 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("bb") cgb.CreateCommand("bb")
.Description("Says bye to someone.\n**Usage**: @NadekoBot bb @X") .Description("Says bye to someone.\n**Usage**: @NadekoBot bb @X")
.Parameter("ppl", ParameterType.Unparsed) .Parameter("ppl", ParameterType.Unparsed)
.Do(async e => { .Do(async e =>
{
var str = "Bye"; var str = "Bye";
foreach (var u in e.Message.MentionedUsers) { foreach (var u in e.Message.MentionedUsers)
{
if (u.Id != NadekoBot.Client.CurrentUser.Id) if (u.Id != NadekoBot.Client.CurrentUser.Id)
str += " " + u.Mention; str += " " + u.Mention;
} }
@ -324,13 +403,16 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("call") cgb.CreateCommand("call")
.Description("Useless. Writes calling @X to chat.\n**Usage**: @NadekoBot call @X ") .Description("Useless. Writes calling @X to chat.\n**Usage**: @NadekoBot call @X ")
.Parameter("who", ParameterType.Required) .Parameter("who", ParameterType.Required)
.Do(async e => { .Do(async e =>
{
await e.Channel.SendMessage("Calling " + e.Args[0] + "..."); await e.Channel.SendMessage("Calling " + e.Args[0] + "...");
}); });
cgb.CreateCommand("hide") cgb.CreateCommand("hide")
.Description("Hides Nadeko in plain sight!11!!") .Description("Hides Nadeko in plain sight!11!!")
.Do(async e => { .Do(async e =>
using (var ms = Resources.hidden.ToStream(ImageFormat.Png)) { {
using (var ms = Resources.hidden.ToStream(ImageFormat.Png))
{
await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: ms); await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: ms);
} }
await e.Channel.SendMessage("*hides*"); await e.Channel.SendMessage("*hides*");
@ -338,8 +420,10 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("unhide") cgb.CreateCommand("unhide")
.Description("Unhides Nadeko in plain sight!1!!1") .Description("Unhides Nadeko in plain sight!1!!1")
.Do(async e => { .Do(async e =>
using (var fs = new FileStream("data/avatar.png", FileMode.Open)) { {
using (var fs = new FileStream("data/avatar.png", FileMode.Open))
{
await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: fs); await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: fs);
} }
await e.Channel.SendMessage("*unhides*"); await e.Channel.SendMessage("*unhides*");
@ -347,17 +431,22 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("dump") cgb.CreateCommand("dump")
.Description("Dumps all of the invites it can to dump.txt.** Owner Only.**") .Description("Dumps all of the invites it can to dump.txt.** Owner Only.**")
.Do(async e => { .Do(async e =>
{
if (!NadekoBot.IsOwner(e.User.Id)) return; if (!NadekoBot.IsOwner(e.User.Id)) return;
var i = 0; var i = 0;
var j = 0; var j = 0;
var invites = ""; var invites = "";
foreach (var s in client.Servers) { foreach (var s in client.Servers)
try { {
try
{
var invite = await s.CreateInvite(0); var invite = await s.CreateInvite(0);
invites += invite.Url + "\n"; invites += invite.Url + "\n";
i++; i++;
} catch { }
catch
{
j++; j++;
continue; continue;
} }
@ -368,11 +457,13 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("ab") cgb.CreateCommand("ab")
.Description("Try to get 'abalabahaha'") .Description("Try to get 'abalabahaha'")
.Do(async e => { .Do(async e =>
{
string[] strings = { "ba", "la", "ha" }; string[] strings = { "ba", "la", "ha" };
var construct = "@a"; var construct = "@a";
var cnt = rng.Next(4, 7); var cnt = rng.Next(4, 7);
while (cnt-- > 0) { while (cnt-- > 0)
{
construct += strings[rng.Next(0, strings.Length)]; construct += strings[rng.Next(0, strings.Length)];
} }
await e.Channel.SendMessage(construct + "~"); await e.Channel.SendMessage(construct + "~");
@ -381,9 +472,11 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("av").Alias("avatar") cgb.CreateCommand("av").Alias("avatar")
.Parameter("mention", ParameterType.Required) .Parameter("mention", ParameterType.Required)
.Description("Shows a mentioned person's avatar.\n**Usage**: ~av @X") .Description("Shows a mentioned person's avatar.\n**Usage**: ~av @X")
.Do(async e => { .Do(async e =>
{
var usr = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault(); var usr = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (usr == null) { if (usr == null)
{
await e.Channel.SendMessage("Invalid user specified."); await e.Channel.SendMessage("Invalid user specified.");
return; return;
} }
@ -391,10 +484,10 @@ namespace NadekoBot.Modules {
}); });
cgb.CreateCommand("leet") cgb.CreateCommand("leet")
.Description("Convert your text to leetspeak. Level is a number 1-6.\n**Usage**: @BotName leet [level] [Your text here]")
.Parameter("level", ParameterType.Required) .Parameter("level", ParameterType.Required)
.Parameter("text", ParameterType.Unparsed) .Parameter("text", ParameterType.Unparsed)
.Do(async e => { .Do(async e =>
{
var text = e.GetArg("text")?.Trim(); var text = e.GetArg("text")?.Trim();
var levelStr = e.GetArg("level")?.Trim(); var levelStr = e.GetArg("level")?.Trim();
int level; int level;
@ -408,14 +501,16 @@ namespace NadekoBot.Modules {
}); });
} }
public Stream RipName(string name, string year = null) { public Stream RipName(string name, string year = null)
{
var bm = Resources.rip; var bm = Resources.rip;
var offset = name.Length * 5; var offset = name.Length * 5;
var fontSize = 20; var fontSize = 20;
if (name.Length > 10) { if (name.Length > 10)
{
fontSize -= (name.Length - 10) / 2; fontSize -= (name.Length - 10) / 2;
} }