Esempio n. 1
0
        public async Task KickFromGang([Remainder] IGuildUser user)
        {
            if (!GangRepository.IsMemberOf(Context.User.Id, Context.Guild.Id, user.Id))
            {
                throw new Exception("This user is not a member of your gang!");
            }
            var gang = GangRepository.FetchGang(Context);

            GangRepository.RemoveMember(user.Id, Context.Guild.Id);
            await ReplyAsync($"{Context.User.Mention}, You have successfully kicked {user} from {gang.Name}");

            var channel = await user.CreateDMChannelAsync();

            await channel.SendMessageAsync($"You have been kicked from {gang.Name}.");
        }
Esempio n. 2
0
        public async Task LeaveGang()
        {
            var gang   = GangRepository.FetchGang(Context);
            var prefix = GuildRepository.FetchGuild(Context.Guild.Id).Prefix;

            if (gang.LeaderId == Context.User.Id)
            {
                throw new Exception($"You may not leave a gang if you are the owner. Either destroy the gang with the `{prefix}DestroyGang` command, or " +
                                    $"transfer the ownership of the gang to another member with the `{prefix}TransferLeadership` command.");
            }
            GangRepository.RemoveMember(Context.User.Id, Context.Guild.Id);
            await ReplyAsync($"{Context.User.Mention}, You have successfully left {gang.Name}");

            var channel = await Context.Client.GetUser(gang.LeaderId).CreateDMChannelAsync();

            await channel.SendMessageAsync($"{Context.User} has left {gang.Name}.");
        }