Beispiel #1
0
        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);
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     // Enables Console Virtual Terminal Sequences
     CVTS.TryEnable();
     CVTS.WriteLineInfo($"{Process.GetCurrentProcess().ProcessName} version {Process.GetCurrentProcess().MainModule.FileVersionInfo.ProductVersion}, created by Jaika★.");
     // Download/reload Splatoon 2 data from the internet/local storage
     Data.LoadSplatoon2Data();
     // Load the config and shared info.
     Config = Config.LoadConfig();
     SharedBotInfo.LoadSharedInfo();
     SharedUserInfo.LoadUserInfo();
     // Initialise both bots
     DiscordBot.Init();
     TwitchBot.ChannelJoined += TwitchBot_ChannelJoined;
     TwitchBot.Connected     += TwitchBot_Connected;
     // Start both bots
     _ = DiscordBot.StartBot(Config.DiscordBotToken); // Needs discard token '_' since this function is asyncronous.
     _ = TwitchBot.Connect(Config.TwitchBotUsername, Config.TwitchOAuth2);
     // Sleep the thread indefinitely to stop it from closing.
     Thread.Sleep(-1);
 }