aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushClientUser.ts
blob: a9a47f9116b78f3f52afece596699ad90d2fea4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import type {
	ActivityOptions,
	Base64Resolvable,
	BufferResolvable,
	ClientPresence,
	ClientUser,
	ClientUserEditData,
	PresenceData,
	PresenceStatusData
} from 'discord.js';
import { BushUser } from './BushUser';

/**
 * Represents the logged in client's Discord user.
 */
export declare class BushClientUser extends BushUser implements ClientUser {
	/**
	 * If the bot's {@link ClientApplication.owner Owner} has MFA enabled on their account
	 */
	public mfaEnabled: boolean;

	/**
	 * Represents the client user's presence
	 */
	public readonly presence: ClientPresence;

	/**
	 * Whether or not this account has been verified
	 */
	public verified: boolean;

	/**
	 * Edits the logged in client.
	 * @param data The new data
	 */
	public edit(data: ClientUserEditData): Promise<this>;

	/**
	 * Sets the activity the client user is playing.
	 * @param name Activity being played, or options for setting the activity
	 * @param options Options for setting the activity
	 * @example
	 * // Set the client user's activity
	 * client.user.setActivity('discord.js', { type: 'WATCHING' });
	 */
	public setActivity(options?: ActivityOptions): ClientPresence;
	public setActivity(name: string, options?: ActivityOptions): ClientPresence;

	/**
	 * Sets/removes the AFK flag for the client user.
	 * @param afk Whether or not the user is AFK
	 * @param shardId Shard Id(s) to have the AFK flag set on
	 */
	public setAFK(afk: boolean, shardId?: number | number[]): ClientPresence;

	/**
	 * Sets the avatar of the logged in client.
	 * @param avatar The new avatar
	 * @example
	 * // Set avatar
	 * client.user.setAvatar('./avatar.png')
	 *   .then(user => console.log(`New avatar set!`))
	 *   .catch(console.error);
	 */
	public setAvatar(avatar: BufferResolvable | Base64Resolvable | null): Promise<this>;

	/**
	 * Sets the full presence of the client user.
	 * @param data Data for the presence
	 * @example
	 * // Set the client user's presence
	 * client.user.setPresence({ activities: [{ name: 'with discord.js' }], status: 'idle' });
	 */
	public setPresence(data: PresenceData): ClientPresence;

	/**
	 * Sets the status of the client user.
	 * @param status Status to change to
	 * @param shardId Shard id(s) to have the activity set on
	 * @example
	 * // Set the client user's status
	 * client.user.setStatus('idle');
	 */
	public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence;

	/**
	 * Sets the username of the logged in client.
	 * <info>Changing usernames in Discord is heavily rate limited, with only 2 requests
	 * every hour. Use this sparingly!</info>
	 * @param username The new username
	 * @example
	 * // Set username
	 * client.user.setUsername('discordjs')
	 *   .then(user => console.log(`My new username is ${user.username}`))
	 *   .catch(console.error);
	 */
	public setUsername(username: string): Promise<this>;
}