Skip to content

Commit

Permalink
Comment our the automod feature to get the game feeds working.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pickysaurus committed Aug 28, 2024
1 parent 137982b commit ff49866
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"typescript": "^5.1.6"
},
"dependencies": {
"@discordjs/rest": "^2.0.1",
"@nexusmods/nexus-api": "^1.1.5",
"@types/cookie-parser": "^1.4.3",
"@types/express": "^4.17.17",
Expand All @@ -29,7 +28,7 @@
"@types/pg": "^8.10.2",
"axios": "^1.6.0",
"cookie-parser": "^1.4.6",
"discord.js": "^14.15.2",
"discord.js": "^14.15.3",
"dotenv": "^16.3.1",
"ejs": "^3.1.10",
"express": "^4.19.2",
Expand Down
3 changes: 1 addition & 2 deletions src/DiscordBot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Client, Collection, GatewayIntentBits, Routes, Snowflake, IntentsBitField, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
import { REST } from '@discordjs/rest';
import { REST, Client, Collection, GatewayIntentBits, Routes, Snowflake, IntentsBitField, RESTPostAPIApplicationCommandsJSONBody } from 'discord.js';
import * as fs from 'fs';
import path from 'path';
import { logMessage } from './api/util';
Expand Down
12 changes: 6 additions & 6 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { GameFeedManager } from '../feeds/GameFeedManager';
import { EmbedBuilder, Guild, TextChannel, ActivityType, GuildBasedChannel } from 'discord.js';
import { getAllServers, deleteServer } from '../api/bot-db';
import { BotServer } from '../types/servers';
import { ModFeedManager } from '../feeds/ModFeedManager';
import { NewsFeedManager } from '../feeds/NewsFeedManager';
import { logMessage } from '../api/util';
import { DiscordEventInterface, ClientExt } from '../types/DiscordTypes';
import { AutoModManager } from '../feeds/AutoModManager';

import { NewsFeedManager } from '../feeds/NewsFeedManager';
import { ModFeedManager } from '../feeds/ModFeedManager';
import { GameFeedManager } from '../feeds/GameFeedManager';
// import { AutoModManager } from '../feeds/AutoModManager';

// Prepare the online status embed for quick reuse.
const onlineEmbed = new EmbedBuilder()
Expand All @@ -17,15 +18,14 @@ const main: DiscordEventInterface = {
name: 'ready',
once: true,
async execute(client: ClientExt) {
client.user?.setActivity({ name: 'for slash commands', type: ActivityType.Watching, url: 'https://discord.gg/nexusmods' });
if (client.user?.username !== "Nexus Mods") client.user?.setUsername("Nexus Mods");

// Start up the feeds
try {
client.gameFeeds = GameFeedManager.getInstance(client);
client.modFeeds = ModFeedManager.getInstance(client);
client.newsFeed = NewsFeedManager.getInstance(client);
client.automod = AutoModManager.getInstance(client);
// client.automod = AutoModManager.getInstance(client);
}
catch(err) {
logMessage('Error starting up feeds', err, true);
Expand Down
8 changes: 1 addition & 7 deletions src/feeds/AutoModManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AutoModManager {
logMessage(`Automod started with ${this.AutoModRules.length} rules, checking every ${pollTime/1000/60} minutes. Last check ${this.lastCheck}`);
this.runAutomod().catch((err) => logMessage(`Error updating game feeds`, err, true));
})
.catch((err) => logMessage('Error in AutomodManager contructor', err, true));
.catch((err) => logMessage('Error in AutomodManager constructor', err, true));
}

private async getRules() {
Expand Down Expand Up @@ -285,10 +285,4 @@ async function analyseURLS(text: string): Promise<string[]> {
}
}
return result;
}

const safeUrls = ['nexusmods.com', 'youtube.com', 'discord.gg', 'youtu.be'];

function isSafeUrl(input: string) {

}
7 changes: 3 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ __metadata:
languageName: node
linkType: hard

"@discordjs/rest@npm:^2.0.1, @discordjs/rest@npm:^2.3.0":
"@discordjs/rest@npm:^2.3.0":
version: 2.3.0
resolution: "@discordjs/rest@npm:2.3.0"
dependencies:
Expand Down Expand Up @@ -1009,7 +1009,7 @@ __metadata:
languageName: node
linkType: hard

"discord.js@npm:^14.15.2":
"discord.js@npm:^14.15.3":
version: 14.15.3
resolution: "discord.js@npm:14.15.3"
dependencies:
Expand Down Expand Up @@ -2303,7 +2303,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "nexus-bot-typescript@workspace:."
dependencies:
"@discordjs/rest": ^2.0.1
"@nexusmods/nexus-api": ^1.1.5
"@types/cookie-parser": ^1.4.3
"@types/dotenv": ^8.2.0
Expand All @@ -2315,7 +2314,7 @@ __metadata:
axios: ^1.6.0
cookie-parser: ^1.4.6
copyfiles: ^2.4.1
discord.js: ^14.15.2
discord.js: ^14.15.3
dotenv: ^16.3.1
ejs: ^3.1.10
eslint: ^8.47.0
Expand Down

0 comments on commit ff49866

Please sign in to comment.