Quick and dirty way to get the bot on the page.

master
Zed A. Shaw 3 years ago
parent 6c9f7336ef
commit 0d045b74df
  1. 1
      .gitignore
  2. 34
      ljsthw-bot.js

1
.gitignore vendored

@ -21,3 +21,4 @@ tags
# secrets # secrets
secrets secrets
node_modules

@ -1,6 +1,24 @@
import { Client, Intents } from "discord.js"; import { Client, Intents } from "discord.js";
import assert from "assert"; import assert from "assert";
import { TOKEN } from "../secrets/discord.js"; import { TOKEN, chat_secret } from "./secrets/discord.js";
import http from "http";
import { io } from "socket.io-client";
const server = http.createServer();
const socket = io("ws://localhost:5001");
socket.io.on("error", (error) => {
console.error(error);
});
socket.io.on("ping", () => {
console.log("PING");
});
socket.on("connect", () => {
console.log("CONNECTED", socket.connected);
});
const client = new Client({ const client = new Client({
intents: [ intents: [
@ -143,14 +161,12 @@ client.on("messageCreate", async msg => {
} else if(msg.channel.name === "livestream") { } else if(msg.channel.name === "livestream") {
console.log(">>> LIVESTREAM CHAT MESSAGE FROM", msg.author.username, msg.channel.type, msg.channel.name, msg.content); console.log(">>> LIVESTREAM CHAT MESSAGE FROM", msg.author.username, msg.channel.type, msg.channel.name, msg.content);
// banlist lookup user const initials = `${msg.author.username[0]}${msg.author.username[1]}`;
const is_ban = BAN_LIST[msg.author.username];
if(is_ban) { socket.emit("/chat/message", {
console.log("IGNORE BANNED USER", msg.author.username); chat_secret, user_id: initials, text: msg.content
} else { });
// else
// socket_conn send message
}
} else { } else {
console.log("IGNORED MESSAGE FROM", msg.author.username, "IN", msg.channel.name); console.log("IGNORED MESSAGE FROM", msg.author.username, "IN", msg.channel.name);
} }

Loading…
Cancel
Save