public static string BanrouletteDetails(Banroulette banroulette, SocketRole role = null, int userCount = 0) { string desc = ""; desc += $":calendar_spiral: Ban Length: *{banroulette.BanLengthHours} hours.*\n"; desc += $"<:toastie3:454441133876183060> Toastie Reward Pool: *{banroulette.RewardPool} (you can add more by using the `brrp` command)*\n"; if (role != null) { desc += $":star: Required Role: *{role.Name}*\n"; } desc += $":hammer: Participants: "; if (banroulette.MinParticipants > 0) { desc += $"`Min: {banroulette.MinParticipants}` "; } if (banroulette.MaxParticipants > 0) { desc += $"`Max: {banroulette.MaxParticipants}` "; } desc += $"`Current: {userCount}`"; return(desc); }
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.*"); }