guilded-api.js

Official source-code for GuildedAPI.js package!

View the Project on GitHub

Guilded-API.js - Events

Normal Events

ready

Listens for when the bot is connected to the Guilded Gateway.

<GuildedClient>.on('ready', () => {
    console.log("Logged into Guilded!");
});

Message Events

serverMessageCreate

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!');
    }
});

serverMessageUpdate

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!');
    }
});

serverMessageDelete

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

Member Events

serverMemberJoin

Listens for when a member joins a server.

<GuildedClient>.on('serverMemberJoin', (member) => {
    console.log('User ${member.user.id} joined ${member.serverId}!');
});

serverMemberLeft

Listens for when a member leaves the server.

<GuildedClient>.on('serverMemberLeave', (member) => {
    console.log('User ${member.user.id} left ${member.serverId}!');
});

serverMemberUpdate

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

serverMemberBan

Listens for when a server member has been banned.

<GuildedClient>.on('serverMemberBan', (ban) => {
    console.log(`${ban.user.id} was banned by ${ban.bannedBy}`);
});

serverMemberUnban

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

Webhook Events

serverWebhookCreate

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!`)
});

serverWebhookUpdate

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);
});

Other Events

disconnect

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 |