fix: tryna fix vinci errors

This commit is contained in:
2023-03-04 16:50:18 +01:00
parent 878aef7e7a
commit 39a3940683
8 changed files with 3736 additions and 7547 deletions

View File

@@ -1,3 +1,5 @@
# THIS IS OUTDATED
TOKEN=token
PREFIX=v!
MONGODB=mongodb://

View File

@@ -1,6 +1,6 @@
FROM node:lts-alpine
RUN apk add bash ffmpeg msttcorefonts-installer fontconfig
RUN apk add bash ffmpeg msttcorefonts-installer fontconfig libc-dev
RUN update-ms-fonts && fc-cache -f
WORKDIR /app

View File

@@ -1,11 +1,10 @@
import { EventType, eventModule } from '@sern/handler';
import { discordEvent } from '@sern/handler';
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, Message, TextChannel } from 'discord.js';
import * as tf from '@tensorflow/tfjs-node'
import tf from '@tensorflow/tfjs-node'
import axios from 'axios';
import { nsfwModel } from '../index.js';
export default eventModule({
type: EventType.Discord,
export default discordEvent({
name: 'messageCreate',
execute(message: Message) {
message.attachments.forEach(async (attachment) => {

53
events/scam-links.ts Normal file
View File

@@ -0,0 +1,53 @@
import { discordEvent } from '@sern/handler';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
EmbedBuilder,
TextChannel,
} from 'discord.js';
import { scamLinks } from '../index.js';
export default discordEvent({
name: 'messageCreate',
async execute(message) {
if (!message.content.includes('https://')) return;
const index = message.content.indexOf("https://");
let link = 'some goofy ahh string that is gonna be replaced'
if (index !== -1) {
let endIndex = message.content.indexOf(" ", index);
if (endIndex === -1) {
endIndex = message.content.length;
}
link = message.content.substring(index, endIndex);
}
const url = new URL(link);
if (scamLinks.includes(url.hostname)) {
const embed = new EmbedBuilder()
.setTitle(`Se ha detectado un enlace scam en tu mensaje.`)
.setDescription('Por eso, se ha eliminado tu mensaje.\nPor si es un falso positivo, te vamos a dejar abajo el contenido del mensaje para recuperarlo.')
.setFields(
{ name: 'Contenido del mensaje', value: message.content || '(nada)' },
)
.setFooter({ text: 'Esta detección ha sido automatizada por Vinci.' })
const modLogsEmbed = new EmbedBuilder()
.setTitle(`Se ha detectado un enlace scam el mensaje de un usuario.`)
.setDescription('Por eso, se ha eliminado el mensaje.')
.setFields(
{ name: 'Contenido del mensaje', value: message.content || '(nada)' },
)
.setFooter({ text: 'Esta detección ha sido automatizada por Vinci.' })
const button = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setLabel('Enlace que saltó las alarmas.')
.setURL(link)
.setStyle(ButtonStyle.Link)
)
await message.delete()
await message.author.send({ embeds: [embed], components: [button] })
await (await message.client.channels.fetch(process.env.MODLOGS_CHANNEL!) as TextChannel).send({ embeds: [modLogsEmbed], components: [button] })
}
},
});

View File

@@ -12,6 +12,7 @@ import webserver from './util/web/webserver.js'
import minecraftstatus from './util/minecraftstatus.js';
import * as tf from '@tensorflow/tfjs-node'
import * as nsfw from 'nsfwjs'
import axios from 'axios';
// import giveawaychecker from './util/giveawaychecker.js';
let devMode: boolean
@@ -35,9 +36,6 @@ const client = new Client({
],
});
tf.enableProdMode()
export const nsfwModel = await nsfw.load()
mongoose.connect(process.env.MONGODB!).then(() => {
console.log('Connected to MongoDB');
});
@@ -103,10 +101,12 @@ client.on('ready', async () => {
webserver()
} else {
console.log('DevMode got activated, there are no checkers or webserver in this version.')
/* setIntervalAsync(async () => {
await giveawaychecker(client)
}, 10000); */
}
});
tf.enableProdMode()
export const nsfwModel = await nsfw.load()
export const scamLinks = await axios.get('https://api.hyperphish.com/gimme-domains').then(res => res.data as Array<string>)
console.log(scamLinks)
client.login(process.env.TOKEN);

7534
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -36,8 +36,8 @@
"@discordjs/opus": "^0.9.0",
"@discordjs/voice": "^0.14.0",
"@napi-rs/canvas": "^0.1.30",
"@sern/handler": "^2.5.1",
"@tensorflow/tfjs-node": "^3.20.0",
"@sern/handler": "^2.5.3",
"@tensorflow/tfjs-node": "^4.2.0",
"axios": "^1.1.3",
"dayjs": "^1.11.6",
"discord-tictactoe": "^4.0.0",

3669
yarn.lock Normal file

File diff suppressed because it is too large Load Diff