0.0.15 • Published 5 years ago

wikichat v0.0.15

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

I'm bad at naming

Library for interfacing with wikia's Special:Chat extension. Better, faster, stronger than gekkou.

yarn add wikichat
npm install wikichat

Examples

const { Client } = require('wikichat');

const client = new Client({
    username: 'Username',
    password: 'Password',
    chats: [
        'dev',
        'doru'
    ]
}); 

client.on('ready', () => {
    client.chats.get('dev').room.send('Connected successfully to all chats');
    client.chats.get('dev').room.send(`Currently connected to ${clients.chats.size} chats: ${
        client.chats.array()
            .map(chat => chat.name)
            .join(', ')
    }`);
});

client.on('room.main', room => {
    room.send('Hello!');
});

client.on('message', message => {
    if (message.self) {
        // Sent from our account; ignore
        return;
    }

    if (message.text === '!ping') {
        message.room.send('Pong!');
    }
});

client.on('room.private', room => {
    room.send('Hello, what can I help you with?');
});

Events

message(message)

Emitted when a message is received, in any room, after the bot has connected.

message.private(message)

Emitted when a message is received on a private room Does NOT fire when the message is sent before the room was opened, e.g. opened from another triggered by a message send You will need to use room.private to fetch the existing backlog messages

join(user)

Emitted when a user joins a main chat, not fired on private rooms

leave(user)

Emitted when a user leaves chat, not fired on private rooms Fires 45 seconds after a part socket event, or 10 seconds after a logout socket event, to comply with Special:Chat

updateUser(user, attrs)

Emitted when a user updates, either by leaving then joining chat, or updating their status. attrs is a plain object containing all the changed attributes. Might make it a collection someday.

room(room)

Emitted when the bot joins a room

room.main(room)

Emitted when the bot joins a main chat room

room.private(room)

Emitted when the bot joins a private room

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago