Update stuff

This commit is contained in:
Christopher Cookman 2023-09-12 12:31:54 -06:00
parent 1777971946
commit e9faf0ffd8
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 13 additions and 7 deletions

View file

@ -1,4 +1,5 @@
const config = require("./config.json");
const colors = require("colors");
const fs = require("fs");
const SteamUser = require("steam-user");
const TeamFortress2 = require("tf2");
@ -15,19 +16,23 @@ user.logOn(config.steam);
user.on("loggedOn", (stuff) => {
//user.setPersona(1); //Just needed this to check that it was logging in properly, and not false reporting a successful log in lol
console.log("[Steam] Logged into steam")
console.log(`${colors.cyan("[Steam]")} Logged into steam`)
user.gamesPlayed([440]);
tf2.setLang(fs.readFileSync("./tf_english.txt").toString())
if(tf2.lang) console.log("[TF2] Updated the localization files")
if(tf2.lang) console.log(`${colors.yellow("[TF2]")} Updated the localization files`)
})
tf2.on("connectedToGC", (ver) => {
console.log(`[TF2] Connected to GC, version: ${ver}`)
console.log(`${colors.yellow("[TF2]")} Connected to GC, version: ${ver}`)
//sendTestNotifications(); // Added this for debugging
})
tf2.on("disconnectedFromGC", (reason) => {
console.log(`${colors.yellow("[TF2]")} Disconnected from GC, reason: ${reason}`)
})
tf2.on("systemMessage", (msg) => {
console.log(`[TF2] New System Message: ${msg}`)
console.log(`${colors.yellow("[TF2]")} New System Message: ${msg}`)
notif_hook.send({embeds: [
{
description: msg,
@ -37,7 +42,7 @@ tf2.on("systemMessage", (msg) => {
})
tf2.on("itemBroadcast", (msg, username, wasDestruction, defindex) => {
console.log(`[TF2] New Item :\nMsg:${msg}\nUser:${username}\nDestroy?:${wasDestruction}`);
console.log(`${colors.yellow("[TF2]")} New Item :$ {msg}`);
pan_hook.send({content: wasDestruction?"":"@everyone",embeds: [
{
description: msg,
@ -47,7 +52,7 @@ tf2.on("itemBroadcast", (msg, username, wasDestruction, defindex) => {
})
tf2.on("displayNotification", (title, body) => {
console.log(`[TF2] New Notif: ${title}: ${body}`)
console.log(`${colors.yellow("[TF2]")} New Notif: ${title}: ${body}`)
ring_hook.send({embeds: [
{
description: body,
@ -57,7 +62,7 @@ tf2.on("displayNotification", (title, body) => {
})
bot.on("ready", () => {
console.log(`[Discord] Logged in as ${bot.user.tag}`);
console.log(`${colors.blue("[Discord]")} Logged in as ${bot.user.tag}`);
})
bot.on("messageCreate", (msg) => {

View file

@ -17,6 +17,7 @@
},
"homepage": "https://github.com/ChrisChrome/tf2notifs#readme",
"dependencies": {
"colors": "^1.4.0",
"discord.js": "^14.0.3",
"steam-user": "github:DoctorMcKay/node-steam-user",
"tf2": "^3.0.2"