Official source-code for GuildedAPI.js package!
Listens for when the bot is connected to the Guilded Gateway.
<GuildedClient>.on('ready', () => {
console.log("Logged into Guilded!");
});
Listens for when a new message in a server is created.
<GuildedClient>.on('serverMessageCreate', (message) => {
// See if the message is "!ping"
if (message.content === '!ping') {
// Respond with "Pong!" if it is.
message.channel.send('Pong!');
}
});
Listens for when a sent message in a server is edited/updated.
<GuildedClient>.on('serverMessageUpdate', (message) => {
// See if the message is "!pong"
if (message.content === '!pong') {
// Respond with "Ping!" if it is.
message.channel.send('Ping!');
}
});
Listens for when a sent message in a server is deleted.
<GuildedClient>.on('serverMessageDelete', (message) => {
console.log(`User with ID ${message.author.id} deleted a message!`);
});
message
property:
Property | Type |
---|---|
message | GuildedMessage |
Listens for when a member joins a server.
<GuildedClient>.on('serverMemberJoin', (member) => {
console.log('User ${member.user.id} joined ${member.serverId}!');
});
Listens for when a member leaves the server.
<GuildedClient>.on('serverMemberLeave', (member) => {
console.log('User ${member.user.id} left ${member.serverId}!');
});
Listens for when a server member’s roles, nickname or anything updates.
<GuildedClient>.on('serverMemberUpdate', (member) => {
console.log(`${member.user.id} updated: ${member.updatedInfo}`);
});
Property | Type |
---|---|
member | GuildedServerMember |
Listens for when a server member has been banned.
<GuildedClient>.on('serverMemberBan', (ban) => {
console.log(`${ban.user.id} was banned by ${ban.bannedBy}`);
});
Listens for when a server member has been unbanned.
<GuildedClient>.on('serverMemberUnban', (ban) => {
console.log(`${ban.user.id} was unbanned by ${ban.bannedBy}`);
});
Property | Type |
---|---|
ban | GuildedServerMemberBan |
Listens for when a new webhook has been created in a server.
<GuildedClient>.on('serverWebhookCreate', (webhook) => {
console.log(`A new webhook with ID ${webhook.id} in ${webhook.serverId} has been created!`)
});
Listens for when a already-made webhook has been updated.
<GuildedClient>.on('serverWebhookUpdate', (webhook) => {
console.log(`A webhook with ID ${webhook.id} in ${webhook.serverId} has been updated!`)
console.log(`New info:`);
consoe.log(webhook);
});
Listens for when the bot has been disconnected from the Guilded Gateway.
<GuildedClient>.on('disconnect', () => {
console.log(`The bot has logged off from Guilded.`);
});
<GuildedClient>.on('error', (error) => {
console.log(`Error: ${error}`);
});
| Property | Type | | ———– | ———– | | error | any |