new Client(token)
The main class for the Guilded.js library
- Source:
Parameters:
Name | Type | Description |
---|---|---|
token |
String
|
The token of the bot |
Extends
- EventEmitter
Members
(readonly) options :Object
The options of the bot
- Source:
Type:
-
Object
(readonly) token :String
The token of the bot
- Source:
Type:
-
String
Methods
login() → {Promise.<void>}
Connects the bot to the Guilded API
- Source:
Returns:
- Type:
-
Promise.<void>
Examples
client.login();
client.login().then(() => {
console.log('Bot is ready!');
});
Events
closed
Emitted when the bot receives a closed event
- Source:
Example
client.on('closed', () => {
console.log('Bot is closed!');
});
debug
Emitted when the bot receives a debug event
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
String
|
Example
client.on('debug', (message) => {
console.log(message);
});
error
Emitted when the bot receives a error event
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
Error
|
Example
client.on('error', (error) => {
console.log(error);
});
memberBan
Emitted when the bot receives a member ban
- Source:
Parameters:
Name | Type | Description |
---|---|---|
memberBan |
MemberBan
|
Example
client.on('serverMemberBan', (member) => {
console.log(member.nickname);
});
memberJoin
Emitted when the bot receives a member join
- Source:
Parameters:
Name | Type | Description |
---|---|---|
member |
Member
|
Example
client.on('serverMemberJoin', (member) => {
console.log(member.nickname);
});
memberLeave
Emitted when the bot receives a member leave
- Source:
Parameters:
Name | Type | Description |
---|---|---|
member |
MemberRemoved
|
Example
client.on('serverMemberLeft', (member) => {
console.log(member.username);
});
memberRoleUpdate
Emitted when the bot receives a member role update
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rolesUpdated |
RolesUpdated
|
Example
client.on('serverMemberUpdate', (rolesUpdated) => {
console.log(rolesUpdated[0]);
});
memberUnban
Emitted when the bot receives a member unban
- Source:
Parameters:
Name | Type | Description |
---|---|---|
memberBan |
MemberBan
|
Example
client.on('serverMemberUnban', (member) => {
console.log(member.nickname);
});
memberUpdate
Emitted when the bot receives a member update
- Source:
Parameters:
Name | Type | Description |
---|---|---|
member |
MemberUpdated
|
Example
client.on('serverMemberUpdate', (member) => {
console.log(member.username);
});
message
Emitted when the bot receives a message
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
Message
|
Example
client.on('serverMessageCreate', (message) => {
console.log(message.content);
});
messageDelete
Emitted when the bot receives a deleted message
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
Message
|
Example
client.on('serverMessageDelete', (message) => {
console.log(message.content);
});
messageUpdate
Emitted when the bot receives a updated message
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
Message
|
Example
client.on('serverMessageUpdate', (message) => {
console.log(message.content);
});
reactionAdd
Emitted when the bot receives a reaction add
- Source:
Parameters:
Name | Type | Description |
---|---|---|
reaction |
Reaction
|
Example
client.on('messageReactionCreated', (reaction) => {
console.log(reaction.emoteId);
});
reactionRemove
Emitted when the bot receives a reaction remove
- Source:
Parameters:
Name | Type | Description |
---|---|---|
reaction |
Reaction
|
Example
client.on('messageReactionDeleted', (reaction) => {
console.log(reaction.emoteId);
});
ready
Emitted when the bot is ready
- Source:
Parameters:
Name | Type | Description |
---|---|---|
client |
Client
|
The client that emitted the event |
Example
client.on('ready', () => {
console.log('Bot is ready!');
});
webhookCreate
Emitted when the bot receives a webhook create
- Source:
Parameters:
Name | Type | Description |
---|---|---|
webhook |
Webhook
|
Example
client.on('serverWebhookCreate', (webhook) => {
console.log(webhook.name);
});
webhookUpdate
Emitted when the bot receives a webhook update
- Source:
Parameters:
Name | Type | Description |
---|---|---|
webhook |
Webhook
|
Example
client.on('serverWebhookUpdate', (webhook) => {
console.log(webhook.name);
});