Skip to content

Instantly share code, notes, and snippets.

@sudocode1
Last active March 25, 2021 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudocode1/332c4bddadf3878f4d12ffb462fbeab7 to your computer and use it in GitHub Desktop.
Save sudocode1/332c4bddadf3878f4d12ffb462fbeab7 to your computer and use it in GitHub Desktop.
Discord X CLIChat
const Discord = require("discord.js");
const CLIChat = require("clichat.js");
const [bot, client] = [new Discord.Client(), new CLIChat.Client('ip', "discord-interact", true, "SOME_TOKEN")];
client.login();
bot.on('ready', async () => {
console.log("Bot ready");
});
client.on('id', () => {
console.log("CLIChat client ready");
});
bot.on('message', async message => {
if (message.author.id == bot.user.id) return;
if (message.channel.name !== "clichat-interaction") return;
client.send(`${message.member.nickname == null ? message.author.username : message.member.nickname}: ${message.content}\b\n`);
});
client.on('message', async m => {
bot.channels.cache.find(x => x.id == "824750368680050819").send(`${m.username}: ${m.content}`);
});
bot.login("bot token");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment