public async Task RandomWeaponCommand(int level = 30) { IEnumerable <MainWeaponInfo> availableWeapons = from w in Data.MainWeapons where w.Rank <= level select w; MainWeaponInfo randomWeapon = availableWeapons.ElementAt(random.Next(availableWeapons.Count())); await Channel.SendChatMessage($"Through the fun process of pseudo-random number generation, I've decided that you should use the {randomWeapon.GetName(LocaleSetting.English)}! It comes equipped with {randomWeapon.GetSubWeapon().GetName(LocaleSetting.English)} and {randomWeapon.GetSpecialWeapon().GetName(LocaleSetting.English)}!"); }
public async Task RandomWeaponCommand([Summary("Your current level, good for shortening the potential selection for those who are not yet at level 30.")] int level = 30) { SharedUserInfo userInfo = SharedUserInfo.GetUserInfo(Context.User.Id); IEnumerable <MainWeaponInfo> availableWeapons = from w in Data.MainWeapons where w.Rank <= level select w; MainWeaponInfo randomWeapon = availableWeapons.ElementAt(random.Next(availableWeapons.Count())); GuildEmote subEmote; GuildEmote specialEmote; await Context.Channel.SendMessageAsync("Through the fun process of pseudo-random number generation, I've decided that you should use this weapon!", embed : randomWeapon.GetDiscordEmbed(userInfo.Locale, out subEmote, out specialEmote, Context.Guild)); // Currently crashes the bot??? //await Task.Delay(5000); //if (subEmote != null) await Context.Guild.DeleteEmoteAsync(subEmote); //if (specialEmote != null) await Context.Guild.DeleteEmoteAsync(specialEmote); }