Exemplo n.º 1
0
        private async Task Client_JoinedGuild(SocketGuild arg)
        {
            var botGuilds = Client.Guilds.ToList();

            foreach (SocketGuild botGuild in botGuilds)
            {
                var serverRecord = DataMethods.GetServer(botGuild.Id);

                if (serverRecord == null)
                {
                    await DataMethods.AddServer(botGuild.Id, botGuild.Name);

                    Console.WriteLine("server added - " + botGuild.Name);

                    var introChannels = botGuild.TextChannels.Where(x => x.Name.Contains("intros")).ToList();

                    Console.WriteLine("wrote list of channels");

                    foreach (SocketTextChannel introChannel in introChannels)
                    {
                        await DataMethods.AddIntroChannel(botGuild.Id, introChannel.Id);
                    }

                    Console.WriteLine("added channels to database");
                }
            }
        }
Exemplo n.º 2
0
        private async Task Client_Ready()
        {
            await Client.SetGameAsync("!!help for commands", "http://www.google.com", ActivityType.Watching);

            DataMethods.ReloadMenus();

            var botGuilds = Client.Guilds.ToList();

            foreach (SocketGuild botGuild in botGuilds)
            {
                var serverRecord = DataMethods.GetServer(botGuild.Id);

                if (serverRecord == null)
                {
                    await DataMethods.AddServer(botGuild.Id, botGuild.Name);

                    Console.WriteLine("server added - " + botGuild.Name);

                    var introChannels = botGuild.TextChannels.Where(x => x.Name.Contains("intros")).ToList();

                    Console.WriteLine("wrote list of channels");

                    foreach (SocketTextChannel introChannel in introChannels)
                    {
                        await DataMethods.AddIntroChannel(botGuild.Id, introChannel.Id);
                    }
                }
            }
        }