Esempio n. 1
0
                public async ValueTask <AdminCommandResult> SetNicknameAsync([RequireHierarchy] CachedMember target,
                                                                             [Remainder, MustBe(StringLength.ShorterThan, 33)] string newNickname)
                {
                    await target.ModifyAsync(x => x.Nick = newNickname);

                    return(CommandSuccessLocalized("user_nickname_updated"));
                }
Esempio n. 2
0
            public async Task SetNicknameAsync(CachedMember user, [Remainder] string?nickname = null)
            {
                if (user.Id == Context.Guild !.OwnerId)
                {
                    await ReplyErrorAsync(Localization.AdministrationNicknameOwner);

                    return;
                }

                if (Context.CurrentMember !.CheckHierarchy(user) <= 0)
                {
                    await ReplyErrorAsync(Localization.AdministrationUserAboveMe);

                    return;
                }

                if (((CachedMember)Context.User).CheckHierarchy(user) <= 0)
                {
                    await ReplyErrorAsync(Localization.AdministrationUserAbove);

                    return;
                }

                await user.ModifyAsync(x => x.Nick = nickname);

                if (string.IsNullOrEmpty(nickname))
                {
                    await ReplyConfirmationAsync(Localization.AdministrationNicknameRemoved, user);
                }
                else
                {
                    await ReplyConfirmationAsync(Localization.AdministrationNicknameChanged, user, nickname);
                }
            }
Esempio n. 3
0
                public async ValueTask <AdminCommandResult> SetNicknameAsync([RequireHierarchy] CachedMember target)
                {
                    await target.ModifyAsync(x => x.Nick = string.Empty);

                    return(CommandSuccessLocalized("user_nickname_reset"));
                }