Beispiel #1
0
        public async Task AddToGang(IGuildUser user)
        {
            if (GangRepository.InGang(user.Id, Context.Guild.Id))
            {
                throw new Exception("This user is already in a gang.");
            }
            if (GangRepository.IsFull(Context.User.Id, Context.Guild.Id))
            {
                throw new Exception("Your gang is already full!");
            }
            GangRepository.AddMember(Context.User.Id, Context.Guild.Id, user.Id);
            await ReplyAsync($"{user} is now a new member of your gang!");

            var channel = await user.CreateDMChannelAsync();

            await channel.SendMessageAsync($"Congrats! You are now a member of {GangRepository.FetchGang(Context).Name}!");
        }