Last active
March 25, 2021 21:31
-
-
Save sudocode1/332c4bddadf3878f4d12ffb462fbeab7 to your computer and use it in GitHub Desktop.
Discord X CLIChat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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