Пример #1
0
        static StringBuilder MentionsEmbed(AbbybotUser user, string command, List <AbbybotUser> mentions)
        {
            if (mentions == null || mentions.Count == 0)
            {
                return(null);
            }
            StringBuilder message = new StringBuilder();

            if (mentions.Count == 1 && mentions[0].Id == Apis.Discord.__client.CurrentUser.Id)
            {
                message.Append("You ");
                message.Append(command.Replace("abbybot ", ""));
                message.Append("ed me!! Thank you so much!!! **");
                message.Append(user.Preferedname);
                message.Append("**! <:abbyheart:699636931839000606> <a:AbbyHearts:829759075969531984>");
            }
            else if (user.Id == Apis.Discord.__client.CurrentUser.Id)
            {
                message.Append("I ");
                message.Append(command.Replace("abbybot ", ""));
                message.Append("ed you ");
                for (int hu = 0; hu < mentions.Count; hu++)
                {
                    message.Append($"**{mentions[hu].Preferedname}**");
                    if (mentions.Count - hu >= 1)
                    {
                        message.Append(", ");
                    }
                }
                message.Append("!!! <a:abbyrich:731562550923100162> <:abbybearsquish:744219531454709820>");
            }
            else
            {
                message.Append(" Hey");

                for (int hu = 0; hu < mentions.Count; hu++)
                {
                    message.Append($" **{mentions[hu].Preferedname}**");
                    if (mentions.Count - hu >= 1)
                    {
                        message.Append(", ");
                    }
                }

                message.Append("you were ");
                message.Append(command.Replace("abbybot ", ""));
                message.Append("ed by **");
                message.Append(user.Preferedname);
                message.Append("**! :)");
            }
            return(message);
        }
Пример #2
0
        public static async Task <List <AbbybotRole> > GetRolesFromUser(AbbybotUser u)
        {
            List <AbbybotRole> roles = new List <AbbybotRole>();

            var table = await AbbysqlClient.FetchSQL($"SELECT * FROM `user`.`roles` WHERE `UserId` = '{u.Id}' && `GuildId` = '{u.GuildId}';");

            foreach (AbbyRow row in table)
            {
                long Roleid = (long)(row["RoleId"]);
                roles.AddRange(RoleManager.roles.Where(rx => rx.role == (ulong)Roleid).Select(rx => rx));
            }
            return(roles);
        }