/irc.ts

a TypeScript IRC client for modern JS runtimes

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

@csha/irc

A modernized fork of npm:irc.

import { Client } from "@csha/irc";

const client = new Client("irc.libera.chat", "my-irc-bot", {
  channels: ["#my-irc-bot-test"],
});

client.addListener("message", (from: string, to: string, message: string) => {
  console.log(from + " => " + to + ": " + message);
  client.say(to, "I'm a bot!");
});

client.addListener("pm", (from: string, message: string) => {
  console.log(from + " => ME: " + message);
  client.say("csha", "I'm a bot!");
});