예제 #1
0
        public async Task Markov([Remainder, Summary("Markov Sentence")] string markov = null)
        {
            if (markov == null)
            {
                string ReturnMessage = MarkovHandler.ReturnMessage();

                if (ReturnMessage.Length < 2000)
                {
                    await Context.Channel.SendMessageAsync(ReturnMessage);
                }
                else
                {
                    string NewMessage = ReturnMessage.Substring(0, 2000);
                    await Context.Channel.SendMessageAsync(NewMessage);
                }
            }
            else
            {
                MarkovHandler.AddString(markov);
                await Context.Channel.SendMessageAsync("Added message to markov chain.");
            }
        }
예제 #2
0
        public async Task Start()
        {
            string FileLocation = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName + @"\Info.json";

            JObject InfoJsonObject = JObject.Parse(File.ReadAllText(FileLocation));

            string Token = InfoJsonObject.GetValue("BotToken").ToString();

            MarkovHandler.InitializeChain();

            Client   = new DiscordSocketClient();
            Commands = new CommandService();

            Services = new ServiceCollection().BuildServiceProvider();

            await InstallCommands();

            await Client.LoginAsync(TokenType.Bot, Token);

            await Client.StartAsync();

            await Task.Delay(-1);
        }