Skip to content

Commit f90c137

Browse files
committed
Adding command to leave a server as someone is spamming the bot
1 parent 850c583 commit f90c137

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Modules/Admin/Admin.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ public Admin(DiscordSocketClient client, ChannelCheck cc)
2727
Console.WriteLine($"Admin module loaded");
2828
}
2929

30+
[Command("Show-Servers")]
31+
[Summary("Show the servers the bot is in")]
32+
[RequireOwner]
33+
public async Task ListGuilds()
34+
{
35+
StringBuilder sb = new StringBuilder();
36+
var guilds = _client.Guilds.ToList();
37+
foreach (var guild in guilds)
38+
{
39+
sb.AppendLine($"Name: {guild.Name} Id: {guild.Id} Owner: {guild.Owner} OwnerId {guild.OwnerId}");
40+
}
41+
await _cc.Reply(Context, sb.ToString());
42+
}
43+
44+
[Command("Leave-Server")]
45+
[Summary("Leave a server")]
46+
[RequireOwner]
47+
public async Task LeaveServer([Remainder] ulong serverId)
48+
{
49+
await _client.GetGuild(serverId).LeaveAsync();
50+
}
51+
3052
[Command("kick", RunMode = RunMode.Async)]
3153
[Summary("Kick someone, not nice... but needed sometimes")]
3254
[RequireBotPermission(GuildPermission.KickMembers)]

Modules/Admin/ChannelCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace NinjaBotCore.Modules.Admin
1111
{
1212
public class SetChanCommands : ModuleBase
1313
{
14-
private static ChannelCheck _cc;
14+
private static ChannelCheck _cc;
1515

1616
public SetChanCommands(ChannelCheck cc)
1717
{

0 commit comments

Comments
 (0)