Actually had Leave command done in another place commented out
This commit is contained in:
		@@ -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);
 | 
					            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;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//todo owner only
 | 
					 | 
				
			||||||
namespace NadekoBot.Modules.Administration
 | 
					namespace NadekoBot.Modules.Administration
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public partial class Administration
 | 
					    public partial class Administration
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,50 +1,52 @@
 | 
				
			|||||||
//using Discord;
 | 
					using Discord;
 | 
				
			||||||
//using Discord.Commands;
 | 
					using Discord.Commands;
 | 
				
			||||||
//using Discord.WebSocket;
 | 
					using Discord.WebSocket;
 | 
				
			||||||
//using NadekoBot.Attributes;
 | 
					using NadekoBot.Attributes;
 | 
				
			||||||
//using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
//using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
////todo owner only
 | 
					//todo owner only
 | 
				
			||||||
//namespace NadekoBot.Modules.Administration
 | 
					namespace NadekoBot.Modules.Administration
 | 
				
			||||||
//{
 | 
					{
 | 
				
			||||||
//    public partial class Administration
 | 
					    public partial class Administration
 | 
				
			||||||
//    {
 | 
					    {
 | 
				
			||||||
//        [Group]
 | 
					        [Group]
 | 
				
			||||||
//        class SelfCommands
 | 
					        class SelfCommands
 | 
				
			||||||
//        {
 | 
					        {
 | 
				
			||||||
//            private DiscordSocketClient _client;
 | 
					            private DiscordSocketClient _client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            public SelfCommands(DiscordSocketClient client)
 | 
					            public SelfCommands(DiscordSocketClient client)
 | 
				
			||||||
//            {
 | 
					            {
 | 
				
			||||||
//                this._client = client;
 | 
					                this._client = client;
 | 
				
			||||||
//            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            [LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
 | 
					            [LocalizedCommand, LocalizedRemarks, LocalizedSummary, LocalizedAlias]
 | 
				
			||||||
//            [RequireContext(ContextType.Guild)]
 | 
					            [RequireContext(ContextType.Guild)]
 | 
				
			||||||
//            public async Task Leave(IUserMessage umsg, [Remainder] string guildStr)
 | 
					            [OwnerOnly]
 | 
				
			||||||
//            {
 | 
					            public async Task Leave(IUserMessage umsg, [Remainder] string guildStr)
 | 
				
			||||||
//                var channel = (ITextChannel)umsg.Channel;
 | 
					            {
 | 
				
			||||||
 | 
					                var channel = (ITextChannel)umsg.Channel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//                guildStr = guildStr.ToUpperInvariant();
 | 
					                guildStr = guildStr.Trim().ToUpperInvariant();
 | 
				
			||||||
//                var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString() == guildStr) ?? _client.GetGuilds().FirstOrDefault(g => g.Name.ToUpperInvariant() == guildStr);
 | 
					                var server = _client.GetGuilds().FirstOrDefault(g => g.Id.ToString().Trim().ToUpperInvariant() == guildStr) ?? 
 | 
				
			||||||
 | 
					                    _client.GetGuilds().FirstOrDefault(g => g.Name.Trim().ToUpperInvariant() == guildStr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//                if (server == null)
 | 
					                if (server == null)
 | 
				
			||||||
//                {
 | 
					                {
 | 
				
			||||||
//                    await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
 | 
					                    await channel.SendMessageAsync("Cannot find that server").ConfigureAwait(false);
 | 
				
			||||||
//                    return;
 | 
					                    return;
 | 
				
			||||||
//                }
 | 
					                }
 | 
				
			||||||
//                if (server.OwnerId != _client.GetCurrentUser().Id)
 | 
					                if (server.OwnerId != _client.GetCurrentUser().Id)
 | 
				
			||||||
//                {
 | 
					                {
 | 
				
			||||||
//                    await server.LeaveAsync().ConfigureAwait(false);
 | 
					                    await server.LeaveAsync().ConfigureAwait(false);
 | 
				
			||||||
//                    await channel.SendMessageAsync("Left server " + server.Name).ConfigureAwait(false);
 | 
					                    await channel.SendMessageAsync("Left server " + server.Name).ConfigureAwait(false);
 | 
				
			||||||
//                }
 | 
					                }
 | 
				
			||||||
//                else
 | 
					                else
 | 
				
			||||||
//                {
 | 
					                {
 | 
				
			||||||
//                    await server.DeleteAsync().ConfigureAwait(false);
 | 
					                    await server.DeleteAsync().ConfigureAwait(false);
 | 
				
			||||||
//                    await channel.SendMessageAsync("Deleted server " + server.Name).ConfigureAwait(false);
 | 
					                    await channel.SendMessageAsync("Deleted server " + server.Name).ConfigureAwait(false);
 | 
				
			||||||
//                }
 | 
					                }
 | 
				
			||||||
//            }
 | 
					            }
 | 
				
			||||||
//        }
 | 
					        }
 | 
				
			||||||
//    }
 | 
					    }
 | 
				
			||||||
//}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user