Esempio n. 1
0
        private async Task OnGuildAvailable(SocketGuild arg)
        {
            if (!messageHist.ContainsKey(arg.Id))
            {
                messageHist.Add(arg.Id, new List <MsgInfo>());
            }

            bool found = false;

            if (HasMember(config, "GuildTriggers"))
            {
                foreach (string str in config.GuildTriggers) // we'll loop and find id matches to overwrite the triggerMap entry
                {
                    string[] args = str.Split(':');
                    if (args[0].Equals("" + arg.Id))
                    {
                        found = true;
                        triggerMap.Add(arg.Id, args[1]);
                    }
                }
            }
            if (!found)
            {
                triggerMap.Add(arg.Id, "!"); // default command trigger
            }

            /* This is annoying, but since we have the possibility of parsing
             * huge amounts of text, we need to create a thread for each guild
             * when they join and do all of the text processing there.
             */
            await markov.AddGuild(arg.Id);

            await facts.AddGuild(arg.Id);
        }