Actually had Leave command done in another place commented out
This commit is contained in:
parent
81753255b9
commit
62a24b55c2
@ -711,17 +711,5 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
await channel.SendMessageAsync($"Successfuly added a new donator. Total donated amount from this user: {don.Amount} 👑").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Leave(IUserMessage imsg, [Remainder] IGuild guild)
|
||||
{
|
||||
var channel = (ITextChannel)imsg.Channel;
|
||||
|
||||
await guild.LeaveAsync();
|
||||
|
||||
await channel.SendMessageAsync($"Left guild **{guild.Name}**\nId: `{guild.Id}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//todo owner only
|
||||
namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
public partial class Administration
|
||||
|
@ -1,50 +1,52 @@
|
||||
//using Discord;
|
||||
//using Discord.Commands;
|
||||
//using Discord.WebSocket;
|
||||
//using NadekoBot.Attributes;
|
||||
//using System.Linq;
|
||||
//using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Attributes;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
////todo owner only
|
||||
//namespace NadekoBot.Modules.Administration
|
||||
//{
|
||||
// public partial class Administration
|
||||
// {
|
||||
// [Group]
|
||||
// class SelfCommands
|
||||
// {
|
||||
// private DiscordSocketClient _client;
|
||||
//todo owner only
|
||||
namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
class SelfCommands
|
||||
{
|
||||
private DiscordSocketClient _client;
|
||||
|
||||
// public SelfCommands(DiscordSocketClient client)
|
||||
// {
|
||||
// this._client = client;
|
||||
// }
|
||||
public SelfCommands(DiscordSocketClient client)
|
||||
{
|
||||
this._client = client;
|
||||
}
|
||||
|
||||
// [LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
// public async Task Leave(IUserMessage umsg, [Remainder] string guildStr)
|
||||
// {
|
||||
// var channel = (ITextChannel)umsg.Channel;
|
||||
[LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Leave(IUserMessage umsg, [Remainder] string guildStr)
|
||||
{
|
||||
var channel = (ITextChannel)umsg.Channel;
|
||||
|
||||
// guildStr = guildStr.ToUpperInvariant();
|
||||
// var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString() == guildStr) ?? _client.GetGuilds().FirstOrDefault(g => g.Name.ToUpperInvariant() == guildStr);
|
||||
guildStr = guildStr.Trim().ToUpperInvariant();
|
||||
var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString().Trim().ToUpperInvariant() == guildStr) ??
|
||||
_client.GetGuilds().FirstOrDefault(g => g.Name.Trim().ToUpperInvariant() == guildStr);
|
||||
|
||||
// if (server == null)
|
||||
// {
|
||||
// await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
|
||||
// return;
|
||||
// }
|
||||
// if (server.OwnerId != _client.GetCurrentUser().Id)
|
||||
// {
|
||||
// await server.LeaveAsync().ConfigureAwait(false);
|
||||
// await channel.SendMessageAsync("Left server " + server.Name).ConfigureAwait(false);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// await server.DeleteAsync().ConfigureAwait(false);
|
||||
// await channel.SendMessageAsync("Deleted server " + server.Name).ConfigureAwait(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (server == null)
|
||||
{
|
||||
await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
if (server.OwnerId != _client.GetCurrentUser().Id)
|
||||
{
|
||||
await server.LeaveAsync().ConfigureAwait(false);
|
||||
await channel.SendMessageAsync("Left server " + server.Name).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
await server.DeleteAsync().ConfigureAwait(false);
|
||||
await channel.SendMessageAsync("Deleted server " + server.Name).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user