public async Task DieRoll(string sides) { if (!(sides.StartsWith("d"))) { await ReplyAsync("Please prefix your number with the d"); return; } sides = sides.TrimStart('d'); int num; try { num = Convert.ToInt32(sides); if (num < 1) { await ReplyAsync("Cannot be negative!"); return; } } catch (Exception e) { await ReplyAsync("Invalid numero"); return; } await ReplyAsync("Rolled a " + RndNumGen.Roll(num)); }
public async Task CoinFlip() { if (RndNumGen.Roll(2) == 1) { await Context.Channel.SendFileAsync("images/egghead.jpg"); } else { await Context.Channel.SendFileAsync("images/Tails.png"); } }