コード例 #1
0
        internal static Embed BuildWelcomeEmbed(SocketGuildUser user)
        {
            string       welcomeMessage = VerificationHandler.WelcomeMessageBuilder(Global.WelcomeMessage, user);
            EmbedBuilder eb             = new EmbedBuilder()
            {
                Title  = $"***Welcome to Swiss001's Discord server!***",
                Footer = new EmbedFooterBuilder()
                {
                    IconUrl = user.GetAvatarUrl(),
                    Text    = $"{user.Username}#{user.Discriminator}"
                },
                Description  = welcomeMessage,
                ThumbnailUrl = Global.WelcomeMessageURL,
                Color        = Color.Green
            };

            return(eb.Build());
        }
コード例 #2
0
        public async Task CheckVerts()
        {
            var unVertRole = _client.GetGuild(Global.SwissGuildId).Roles.FirstOrDefault(x => x.Id == Global.UnverifiedRoleID);
            var userRole   = _client.GetGuild(Global.SwissGuildId).Roles.FirstOrDefault(x => x.Id == Global.MemberRoleID);

            IUserMessage sMessage = (IUserMessage)await _client.GetGuild(Global.SwissGuildId).GetTextChannel(Global.VerificationChanID).GetMessageAsync(627680940155469844);

            var emote  = new Emoji("✅");
            var reActs = await sMessage.GetReactionUsersAsync(emote, 7500).FlattenAsync();

            foreach (var rUsers in reActs.ToList())
            {
                var user = _client.GetGuild(Global.SwissGuildId).GetUser(rUsers.Id);
                if (user != null)
                {
                    if (user.Roles.Contains(unVertRole))
                    {
                        await user.AddRoleAsync(userRole);

                        Global.ConsoleLog($"Found the user {user.Username}#{user.Discriminator} who hasnt recieved verification yet. Gave them Member role", ConsoleColor.White, ConsoleColor.DarkBlue);
                        EmbedBuilder eb2 = new EmbedBuilder()
                        {
                            Title  = $"Verified {user.Mention}",
                            Color  = Color.Green,
                            Footer = new EmbedFooterBuilder()
                            {
                                IconUrl = user.GetAvatarUrl(),
                                Text    = $"{user.Username}#{user.Discriminator}"
                            },
                            Fields = new List <EmbedFieldBuilder>()
                            {
                                { new EmbedFieldBuilder()
                                  {
                                      IsInline = true,
                                      Name     = "AutoVerified?",
                                      Value    = "true"
                                  } }
                            }
                        };
                        var chan = _client.GetGuild(Global.SwissGuildId).GetTextChannel(Global.VerificationLogChanID);
                        await chan.SendMessageAsync("", false, eb2.Build());

                        await user.RemoveRoleAsync(unVertRole);

                        string       welcomeMessage = VerificationHandler.WelcomeMessageBuilder(Global.WelcomeMessage, user);
                        EmbedBuilder eb             = new EmbedBuilder()
                        {
                            Title  = $"***Welcome to Swiss001's Discord server!***",
                            Footer = new EmbedFooterBuilder()
                            {
                                IconUrl = user.GetAvatarUrl(),
                                Text    = $"{user.Username}#{user.Discriminator}"
                            },
                            Description  = welcomeMessage,
                            ThumbnailUrl = Global.WelcomeMessageURL,
                            Color        = Color.Green
                        };
                        await _client.GetGuild(Global.SwissGuildId).GetTextChannel(Global.WelcomeMessageChanID).SendMessageAsync("", false, eb.Build());
                    }
                }
                else
                {
                }
            }
        }