Fixed rip,insult, praise and improvements
Also added dump command, only owner can run it. It generates invites to all servers the bot is on and saves them to dump.txt.
This commit is contained in:
parent
741e1d0227
commit
3fb1151935
@ -11,6 +11,7 @@ using System.Drawing;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace NadekoBot.Modules
|
||||
{
|
||||
@ -225,23 +226,19 @@ namespace NadekoBot.Modules
|
||||
|
||||
CreateCommand(cgb, "rip")
|
||||
.Description("Shows a grave image.Optional parameter [@X] instructs her to put X's name on the grave.\n**Usage**: @NadekoBot rip [@X]")
|
||||
.Parameter("all", ParameterType.Unparsed)
|
||||
.Parameter("user", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
|
||||
if (e.Message.MentionedUsers.Count() == 1)
|
||||
var usr = client.FindUsers(e.Channel, e.GetArg("user")).FirstOrDefault();
|
||||
string text = "";
|
||||
if (usr == null)
|
||||
{
|
||||
await client.SendFile(e.Channel, @"images\rip.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (User u in e.Message.MentionedUsers)
|
||||
{
|
||||
if (u.Name == "NadekoBot") continue;
|
||||
RipName(u.Name);
|
||||
await client.SendFile(e.Channel, @"images\ripnew.png");
|
||||
text = e.GetArg("user");
|
||||
}
|
||||
else {
|
||||
text = usr.Name;
|
||||
}
|
||||
await client.SendFile(e.Channel, "ripzor_m8.png", RipName(text));
|
||||
});
|
||||
|
||||
cgb.CreateCommand("j")
|
||||
@ -523,6 +520,30 @@ namespace NadekoBot.Modules
|
||||
}
|
||||
});
|
||||
|
||||
cgb.CreateCommand("dump")
|
||||
.Description("Dumps all of the invites it can to dump.txt")
|
||||
.Do(async e =>
|
||||
{
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
string invites = "";
|
||||
foreach (var s in client.AllServers) {
|
||||
try
|
||||
{
|
||||
i++;
|
||||
var invite = await client.CreateInvite(e.Channel, 0, 0);
|
||||
invites+=invite.Url+"\n";
|
||||
}
|
||||
catch (Exception) {
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
File.WriteAllText("dump.txt", invites);
|
||||
await e.Send($"Got invites for {i} servers and failed to get invites for {j} servers");
|
||||
|
||||
});
|
||||
|
||||
|
||||
//TODO add eval
|
||||
/*
|
||||
@ -540,7 +561,7 @@ namespace NadekoBot.Modules
|
||||
});
|
||||
}
|
||||
|
||||
public void RipName(string name)
|
||||
public Stream RipName(string name)
|
||||
{
|
||||
Bitmap bm = new Bitmap(Image.FromFile(@"images\rip.png"));
|
||||
|
||||
@ -560,7 +581,7 @@ namespace NadekoBot.Modules
|
||||
g.Flush();
|
||||
g.Dispose();
|
||||
|
||||
bm.Save(@"images\ripnew.png");
|
||||
return ImageHandler.ImageToStream(bm,ImageFormat.Png);
|
||||
}
|
||||
|
||||
private Func<CommandEventArgs, Task> SayYes()
|
||||
|
Loading…
Reference in New Issue
Block a user