feat: youtube notification system

This commit is contained in:
2022-08-11 10:27:52 +02:00
parent bfa94f343c
commit 9825b9bcb4
6 changed files with 946 additions and 10 deletions

View File

@@ -2,4 +2,5 @@ TOKEN=token
PREFIX=v!
MONGODB=mongodb://
HYPIXEL_API=API_KEY
YOURLS_KEY=YOURLS_SIGNATURE
YOURLS_KEY=YOURLS_SIGNATURE
YOUTUBE_API=

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.env
node_modules/
logs.txt
notes.txt
notes.txt
json.sqlite

View File

@@ -4,14 +4,12 @@ vinci bot
# heres a roadmap
- ~~form to apply for the minecraft server~~ DONE!
- moderation commands (wip)
- ~~moderation commands~~ DONE!
- ~~welcome to users~~ DONE!
- giveaway system (wip)
- economy system
- ~~giveaway system~~ (cancelling for a while)
- modmail
- socials notification system
- ~~socials notification system~~ DONE!
- chatbot using IBM's AI (thanks @gosevil for the idea)
- joke command
- recording voice channels (wip)
- ~~joke command~~
3 stars! tysm!

View File

@@ -5,6 +5,7 @@ const { Sern } = require("@sern/handler");
require("dotenv").config();
const sernPrefix = process.env.PREFIX
const mongoose = require('mongoose');
const youtube = require('discord-bot-youtube-notifications');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessageReactions],
restTimeOffset: 0
@@ -12,11 +13,13 @@ const client = new Client({
export const db = mongoose.connect(process.env.MONGODB, {useNewUrlParser: true,useUnifiedTopology: true}).then(async => {console.log('Connected to MongoDB');})
Sern.init({client,
Sern.init({
client,
sernPrefix,
commands : './commands',
sernEmitter : new SernEmitter(),
events: './events'});
events: './events'
});
client.on('ready', async () => {
@@ -33,4 +36,26 @@ client.on('ready', async () => {
}, 10000);
});
const Notifier = new youtube.notifier(client, {
// Default message
message: "@everyone **¡HAY NUEVO VIDEO EN EL CANAL DE MARA!**\nRecomiendo verlo, es muy chulo.",
// Time interval to check for new uploads
updateTime: 60000, // in milliseconds,
// Give the mongo URI if you wanna save data in mongoose otherwise quick.db is used
mongoURI: process.env.MONGODB,
// Auto send the embed to the provided channel
autoSend: true, // if false you will get A "upload" event
// The youtube data v3 API key, Send this if you want updates to be fast and precise because without the key it take 10-15 minutes more time to get latest videos
apiKey: process.env.YOUTUBE_API,
});
const youtube_channel_id = "UC9G2yvrtrPeJFEzwlshg5HA";
const discord_channel_id = "929003311280033863";
Notifier.addNotifier(youtube_channel_id, discord_channel_id);
client.login(process.env.TOKEN);

910
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,6 +23,7 @@
"dependencies": {
"@sern/handler": "^1.1.8-beta",
"axios": "^0.27.2",
"discord-bot-youtube-notifications": "github:KartikeSingh/discord-youtube-notifications",
"discord-giveaways": "^6.0.1",
"discord.js": "^14.1.2",
"dotenv": "^16.0.1",