node-irc
node-irc copied to clipboard
Client.say/notice ect
I dont know if im doing something wrong but if i export client and try to use client.say(channel, message) in another file with client required i get client.say is not a function
Cannot recreate without more detail.
Here is my client.js
file:
let irc = require('irc');
let defaultConfig = {
server: 'us.undernet.org',
nick: 'exportClientTest',
chan: '#exportClientTest'
};
let ircClient = new irc.Client(defaultConfig.server, defaultConfig.nick, {
channels: [defaultConfig.chan],
});
ircClient.addListener('error', (msg) => {
console.error('[ERR] ' + msg);
});
module.exports = {
client: ircClient,
channel: defaultConfig.chan
};
and here is the file that uses it:
let {client, channel} = require('./client');
setInterval(() => {
client.say(channel, 'Hello, World!');
}, 10000);
Here is the result: