node-irc icon indicating copy to clipboard operation
node-irc copied to clipboard

Client.say/notice ect

Open Gaz492 opened this issue 7 years ago • 1 comments

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

Gaz492 avatar Apr 17 '17 10:04 Gaz492

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: irc channel showing Hello World post

john-patterson avatar Jun 17 '17 21:06 john-patterson