functioning start
This commit is contained in:
37
index.js
Normal file
37
index.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const config = require('./config.json');
|
||||
|
||||
// the basic discord setup stuff yoinked from their guide
|
||||
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.MessageContent
|
||||
],
|
||||
partials: [
|
||||
Partials.Channel,
|
||||
Partials.Message
|
||||
]
|
||||
});
|
||||
client.once(Events.ClientReady, readyClient => {
|
||||
console.log(`Discord: Connected as ${readyClient.user.tag}`);
|
||||
});
|
||||
client.login(config.token);
|
||||
|
||||
client.on(Events.MessageCreate, message => {
|
||||
// if we smell a twitter link, girlcock it!
|
||||
const regexProfile = /https?:\/\/x\.com\/(.*?)\/status\/(\d+)/;
|
||||
if (message.content.match(regexProfile)) {
|
||||
const original = message.content.match(regexProfile)[0]
|
||||
const profile = message.content.match(regexProfile)[1]
|
||||
const stub = message.content.match(regexProfile)[2]
|
||||
console.log(`Chat: Detected ${original}, girlcocking it!`);
|
||||
const cocklink = `https://girlcockx.com/${profile}/status/${stub}`
|
||||
console.log(`Girlcock: Converted to ${cocklink}`)
|
||||
message.channel.send(cocklink)
|
||||
message.suppressEmbeds().catch(err => // this bit is ai generated because i am lazy
|
||||
console.error(err.stack?.split('\n')[0] || err.message || String(err).split('\n')[0])
|
||||
)
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user