Add user notes
This commit is contained in:
parent
4dc715a39a
commit
949206738b
|
@ -54,6 +54,7 @@ export const Modules = {
|
|||
get PrivacySettingsModal() { return this._getModule('PrivacySettingsModal'); },
|
||||
get UserProfileModal() { return this._getModule('UserProfileModal'); },
|
||||
get APIModule() { return this._getModule('APIModule'); },
|
||||
get UserNoteStore() { return this._getModule('UserNoteStore'); },
|
||||
|
||||
get DiscordPermissions() { return this.DiscordConstants.Permissions; }
|
||||
};
|
||||
|
|
|
@ -53,6 +53,8 @@ const KnownModules = {
|
|||
UserTypingStore: Filters.byProperties(['isTyping']),
|
||||
UserActivityStore: Filters.byProperties(['getActivity']),
|
||||
UserNameResolver: Filters.byProperties(['getName']),
|
||||
UserNoteStore: Filters.byProperties(['getNote']),
|
||||
UserNoteActions: Filters.byProperties(['updateNote']),
|
||||
|
||||
/* Emoji Store and Utils */
|
||||
EmojiInfo: Filters.byProperties(['isEmojiDisabled']),
|
||||
|
|
|
@ -69,6 +69,23 @@ export class User {
|
|||
return Modules.UserStatusStore.getActivity(this.id);
|
||||
}
|
||||
|
||||
get note() {
|
||||
const note = Modules.UserNoteStore.getNote(this.id);
|
||||
if (note) return note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the note for this user.
|
||||
* @param {String} note The new note
|
||||
* @return {Promise}
|
||||
*/
|
||||
updateNote(note) {
|
||||
return Modules.APIModule.put({
|
||||
url: `${Modules.DiscordConstants.Endpoints.NOTES}/${this.id}`,
|
||||
body: { note }
|
||||
});
|
||||
}
|
||||
|
||||
get privateChannel() {
|
||||
return DiscordApi.channels.find(c => c.type === 'DM' && c.recipientId === this.id);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue