예제 #1
0
        public static async void Kick(string moderator, ITextChannel channel, SocketGuildUser user, string reason)
        {
            try {
                //Kick user
                await user.KickAsync(reason);

                //Announce kick in channel where infraction occured
                var embed = Embeds.Kick(user, reason);
                await channel.SendMessageAsync("", embed : embed).ConfigureAwait(false);

                //Log kick in bot-logs
                embed = Embeds.KickLog(moderator, channel, user, reason);
                var botlog = await channel.Guild.GetTextChannelAsync(UserSettings.Channels.BotLogsId(user.Guild.Id));

                if (botlog != null)
                {
                    await botlog.SendMessageAsync("", embed : embed).ConfigureAwait(false);
                }
            }
            catch
            {
                await channel.SendMessageAsync(UserSettings.BotOptions.GetString("NoPermissionMessage", channel.Guild.Id));
            }
        }