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")); }
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); } }
public async ValueTask <AdminCommandResult> SetNicknameAsync([RequireHierarchy] CachedMember target) { await target.ModifyAsync(x => x.Nick = string.Empty); return(CommandSuccessLocalized("user_nickname_reset")); }