Added randserver command
Moved avatar to conversations from searches.
This commit is contained in:
parent
df48edf727
commit
e62849f999
@ -535,16 +535,59 @@ namespace NadekoBot.Modules
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
j++;
|
j++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File.WriteAllText("dump.txt", invites);
|
File.WriteAllText("dump.txt", invites);
|
||||||
await e.Send($"Got invites for {i} servers and failed to get invites for {j} servers");
|
await e.Send($"Got invites for {i} servers and failed to get invites for {j} servers");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Stopwatch randServerSW = new Stopwatch();
|
||||||
|
randServerSW.Start();
|
||||||
|
|
||||||
|
cgb.CreateCommand("randserver")
|
||||||
|
.Description("Generates an invite to a random server and prints some stats.")
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
if (randServerSW.ElapsedMilliseconds / 1000 < 1800)
|
||||||
|
{
|
||||||
|
await e.Send("You have to wait " + (1800 - randServerSW.ElapsedMilliseconds / 1000) + " more seconds to use this function.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
randServerSW.Reset();
|
||||||
|
while (true) {
|
||||||
|
var server = client.AllServers.OrderBy(x => rng.Next()).FirstOrDefault();
|
||||||
|
if (server == null)
|
||||||
|
continue;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var inv = await client.CreateInvite(server, 100, 5);
|
||||||
|
await e.Send("**Server:** " + server.Name +
|
||||||
|
"\n**Owner:** " + server.Owner.Name +
|
||||||
|
"\n**Channels:** " + server.Channels.Count() +
|
||||||
|
"\n**Total Members:** " + server.Members.Count() +
|
||||||
|
"\n**Online Members:** " + server.Members.Where(u => u.Status == UserStatus.Online).Count() +
|
||||||
|
"\n**Invite:** " + inv.Url);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception) { continue; }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cgb.CreateCommand("av").Alias("avatar")
|
||||||
|
.Parameter("mention", ParameterType.Required)
|
||||||
|
.Description("Shows a mentioned person's avatar. **Usage**: ~av @X")
|
||||||
|
.Do(async e =>
|
||||||
|
{
|
||||||
|
var usr = client.FindUsers(e.Channel, e.GetArg("mention")).FirstOrDefault();
|
||||||
|
if (usr == null) {
|
||||||
|
await e.Send("Invalid user specified.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string av = usr.AvatarUrl;
|
||||||
|
await e.Send(Searches.ShortenUrl(av));
|
||||||
|
});
|
||||||
|
|
||||||
//TODO add eval
|
//TODO add eval
|
||||||
/*
|
/*
|
||||||
|
@ -28,19 +28,6 @@ namespace NadekoBot.Modules
|
|||||||
|
|
||||||
manager.CreateCommands("",cgb =>
|
manager.CreateCommands("",cgb =>
|
||||||
{
|
{
|
||||||
cgb.CreateCommand("~av")
|
|
||||||
.Parameter("mention", Discord.Commands.ParameterType.Required)
|
|
||||||
.Description("Shows a mentioned person's avatar. **Usage**: ~av @X")
|
|
||||||
.Do(async e =>
|
|
||||||
{
|
|
||||||
if (e.Message.MentionedUsers.Count() == 0) {
|
|
||||||
await e.Send( "You need to mention a person");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string av = e.Message.MentionedUsers.First().AvatarUrl;
|
|
||||||
await e.Send( ShortenUrl("http://www.discordapp.com/api/" + av));
|
|
||||||
|
|
||||||
});
|
|
||||||
cgb.CreateCommand("~yt")
|
cgb.CreateCommand("~yt")
|
||||||
.Parameter("query",Discord.Commands.ParameterType.Unparsed)
|
.Parameter("query",Discord.Commands.ParameterType.Unparsed)
|
||||||
.Description("Queries youtubes and embeds the first result")
|
.Description("Queries youtubes and embeds the first result")
|
||||||
|
Loading…
Reference in New Issue
Block a user