Example #1
0
        private async Task CallServerAddedBot(SocketGuild guild)
        {
            var discordServerFactory = new DiscordServerContextFactory();
            var restGuild            = await Server.GetGuild(guild.Id);

            var discordServer = discordServerFactory.Create(restGuild);

            OnDiscordServerAddedBot.ForEach(x => x.Invoke(discordServer));
        }
Example #2
0
        public async Task <IEnumerable <DiscordServerContext> > GetDiscordServers()
        {
            var serverContextFactory = new DiscordServerContextFactory();
            var guilds = await this._restClient.GetGuildsAsync();

            var serverContexts = guilds.Select(x => serverContextFactory.Create(x));

            return(serverContexts);
        }
Example #3
0
        private async Task CallUserJoined(SocketGuildUser guildUser)
        {
            var userFactory   = new UserContextsFactory();
            var serverFactory = new DiscordServerContextFactory();

            var userContext = userFactory.Create(guildUser);
            var guild       = await Server.GetGuild(guildUser.Guild.Id);

            var discordServerContext = serverFactory.Create(guild);
            var landingChannel       = discordServerContext.LandingChannel;

            var contexts = new Contexts();

            contexts.SetContext(userContext);
            contexts.SetContext(discordServerContext);
            if (landingChannel != null)
            {
                contexts.SetContext(landingChannel);
            }

            OnUserJoined.ForEach(x => x.Invoke(contexts));
        }