コード例 #1
0
        private Task Client_Ready()
        {
            Logger.Information("Client Ready event fired.");

            foreach (var guildId in inactivityService.Model.GuildInactivityMessage.Keys)
            {
                inactivityService.SetupInactivityReaction(guildId);
            }

            foreach (var guildId in inactivityService.Model.GuildMemberUpdateEvents.Keys)
            {
                inactivityService.SetupGuildMemberUpdated(guildId);
            }

            foreach (var guildId in communityApplicationService.Model.GuildApplicationMessage.Keys)
            {
                communityApplicationService.SetupApplications(guildId);
            }

            return(Task.CompletedTask);
        }
コード例 #2
0
        public async Task StartGuildMemberUpdateEvents()
        {
            await Context.Channel.TriggerTypingAsync();

            ulong guildId = Context.Guild.Id;

            BaseService.GetGuildCulture(guildId);

            if (!InactivityModel.GuildInactivityRole.ContainsKey(guildId))
            {
                await ReplyAsync(Inactivity.Inactivity_MissingRole);

                return;
            }

            if (!InactivityModel.GuildDestinationChannel.ContainsKey(guildId))
            {
                await ReplyAsync(Inactivity.Inactivity_MissingChannel);

                return;
            }

            if (InactivityModel.GuildMemberUpdateEvents.ContainsKey(guildId))
            {
                InactivityModel.GuildMemberUpdateEvents[guildId] = true;
            }
            else
            {
                InactivityModel.GuildMemberUpdateEvents.Add(guildId, true);
            }

            await InactivityModel.SaveJsonAsync(InactivityModel.inactivityFileName);

            InactivityService.SetupGuildMemberUpdated(guildId);

            await ReplyAsync(Inactivity.GuildMemberUpdated_Start);

            return;
        }