Ejemplo n.º 1
0
        public async Task SetupAsync()
        {
            //VARIABLES
            var                guild              = Context.Guild;
            List <Reaction>    reactions          = new List <Reaction>();
            List <Mute>        mutes              = new List <Mute>();
            List <UserWarning> warnings           = new List <UserWarning>();
            CustomAnnouncement customAnnouncement = new CustomAnnouncement();
            GuildInfo          guildInfo          = new GuildInfo
            {
                ServerName   = guild.Name,
                CreationDate = guild.CreatedAt.ToString(),
                Creator      = $"{guild.Owner.Username}#{guild.Owner.Discriminator}",
                CreatorId    = guild.OwnerId,
                BannerURL    = guild.BannerUrl
            };

            GuildModel newGuild = new GuildModel
            {
                GuildID            = guild.Id.ToString(),
                GuildInfo          = guildInfo,
                Mutes              = mutes,
                Reactions          = reactions,
                UserWarnings       = warnings,
                CustomAnnouncement = customAnnouncement
            };

            //Run the InitServer method which inputs the server into the database
            MongoCRUD.Instance.InitServer(newGuild);

            //Reply with setup is complete if it doesnt break
            await ReplyAsync("Setup complete");
        }
Ejemplo n.º 2
0
        private async Task GuildJoin(SocketGuild guild)
        {
            //Creating the variables we need for the setup command
            List <Reaction>    reactions          = new List <Reaction>();
            List <Mute>        mutes              = new List <Mute>();
            List <UserWarning> warnings           = new List <UserWarning>();
            CustomAnnouncement customAnnouncement = new CustomAnnouncement();
            GuildInfo          guildInfo          = new GuildInfo
            {
                ServerName   = guild.Name,
                CreationDate = guild.CreatedAt.ToString(),
                Creator      = $"{guild.Owner.Username}#{guild.Owner.Discriminator}",
                CreatorId    = guild.OwnerId,
                BannerURL    = guild.BannerUrl
            };

            GuildModel newGuild = new GuildModel
            {
                GuildID            = guild.Id.ToString(),
                GuildInfo          = guildInfo,
                Mutes              = mutes,
                Reactions          = reactions,
                UserWarnings       = warnings,
                CustomAnnouncement = customAnnouncement
            };

            //Run the init server method which inputs the server into the database
            MongoCRUD.Instance.InitServer(newGuild);

            await Task.CompletedTask;
        }