コード例 #1
0
        public static async Task Handle(SocketMessage message)
        {
            AbbybotCommandArgs aca = await AbbybotCommandArgs.MakeArgsFromMessage(message);

            var osi = await UserTrustSql.GetUserTimeout(aca.user.Id);

            aca.user.inTimeOut      = osi.inTimeout;
            aca.user.timeoutReason  = osi.reason;
            aca.user.TimeOutEndDate = osi.timeoutEndDate;
            capi.Start(aca);
        }
コード例 #2
0
        async Task Init(SocketUser author)
        {
            if (author == null)
            {
                throw new Exception("author is null");
            }

            Id = author.Id;

            Username = author.Username;

            //Abbybot.print(sgu.Guild.Name);
            if (author is SocketGuildUser sgu)
            {
                isGuild = true;
                GuildId = sgu.Guild.Id;

                Nickname = sgu.Nickname;
                var err = Apis.Discord.__client.GetGuild(sgu.Guild.Id).GetUser(sgu.Id);
                Roles = await RoleManager.GetUserRoles(err);

                admin   = sgu.Roles.ToList().Any(rs => rs.Permissions.Administrator);
                Ratings = (await RoleManager.GetRatings(Roles)).ToList();
            }
            var eeeer = (isGuild && Nickname != null) ? Nickname : Username;

            Preferedname = Regex.Replace(eeeer.ToString(),
                                         @"([(\u2100-\u27ff)(\uD83C\uDC00 - \uD83C\uDFFF)(\uD83D\uDC00 - \uD83D\uDFFF)(\uD83E\uDD00 - \uD83E\uDFFF)])",
                                         @"\$1").Replace("\\ ", " ");

            await UserTrustSql.GetUserTimeout(Id);

            var u = await UserSql.GetUserData(Id);

            FavoriteCharacter = u.favoritecharacter;
            MarriedUserId     = u.marriedid;

            IsLewd = u.isLewd;
        }