public async Task Banroulette() { var banroulette = BanrouletteDb.GetBanroulette(Context.Channel.Id); if (banroulette == null) { await Context.Channel.SendMessageAsync($"There is no running Ban Roulette in this channel. `{Program.GetPrefix(Context)}nbr` to start a new one."); return; } var users = BasicUtil.UserList(Context.Client, BanrouletteDb.GetParticipants(banroulette)); var role = Context.Guild.GetRole(banroulette.RoleReqId); string participants = users.Count > 0 ? $"\n\nParticipants:\n{BanrouletteUtil.BanrouletteParticipants(users)}" : ""; await Context.Channel.SendMessageAsync($"{BanrouletteUtil.BanrouletteDetails(banroulette, role, users.Count)}" + participants); }
public async Task NewBanroulette(int hours, [Remainder] string roleName = "") { if (hours < 0) { throw new IndexOutOfRangeException(); } var banroulette = BanrouletteDb.GetBanroulette(Context.Channel.Id); if (banroulette != null) { await Context.Channel.SendMessageAsync(":x: There is already a running Ban Roulette in this channel. Type `!ebr` to end it."); return; } SocketRole role = null; if (roleName != "") { role = await this.SelectRole(roleName); if (role == null) { return; } } banroulette = new Banroulette { Active = true, BanLengthHours = hours, ChannelId = Context.Channel.Id, MaxParticipants = 0, MinParticipants = 0, RewardPool = 0, ServerId = Context.Guild.Id, RoleReqId = role == null ? 0 : role.Id }; string prefix = Program.GetPrefix(Context); await BanrouletteDb.NewBanroulette(banroulette); await Context.Channel.SendMessageAsync("Started a new game of Ban Roulette! It's on.\n\n" + BanrouletteUtil.BanrouletteDetails(banroulette, role) + $"\n\n**More settings:**" + $"\n`{prefix}sbrrp` - set reward pool" + $"\n`{prefix}sbrmin` - minimum participants" + $"\n`{prefix}sbrmax` - maximum participants" + $"\n\n*Type `{prefix}jbr` to join the game.*"); }