youcord-notifications
v1.0.1
Published
get notifications for your channel directly to your discord channel automatically
Downloads
4
Maintainers
Readme
Installations
npm i youcord-notifications
What?
An module to easily recive Youtube uploads notification over Discord Channel.
Why?
- Easy to use.
- Active Support on discord server.
- No API key needed (but API = fast response time).
- psst~ low quota api route supported!
Note
- At least Node JS
14
isrequired
. - The feeds thing of youtube takes some time to update, so the notifications might be bit slow without api.
How ?
NOtifications
const youtube = require('youcord-notifications');
// The client is the Discord Client
const Notifier = new youtube.notifier(client, {
// Default message
message: "Hello @everyone, **{author}** just publish a cool video called **{title}**\nGo show your support\n\nurl : {url}",
// Time interval to check for new uploads
updateTime: 60000, // in milliseconds,
// Give the mongo DB URI
mongoURI: "mongo+srv://something",
// Auto send the embed to the provided channel
autoSend: true, // if false you will get A """Notifier.on("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: "the key",
});
let youtube_channel_id = "UCEQ7rUxYNgErtS09m7JbrQA";
let discord_channel_id = "1113560027433816267";
let notification_message = "{author} just posted a video ({title})\nLink: {url}\nThumbnail: {thumbnail}";
let ping = true;
let guild_id = "831121988608196618";
Notifier.addNotifier(youtube_channel_id, discord_channel_id, notification_message, ping, guild_id);
Listening to events
Notifier.on("upload", (client, data) => {
// Do something with your data
});
// Example Data
const data = {
youtube: "UCEQ7rUxYNgErtS09m7JbrQA ", // The Youtube channel ID
channel: channelID, // The discord channel ID
lastVideo: last.link || "", // Latest video link
message: "new upload", // Custom message
author: "VenomExE", // The name of youtube channel
title: "How to code", // title of the video
link: "https://www.youtube.com/watch?v=52TGPlQimFc", // Link of the video
thumbnail: "https://i9.ytimg.com/vi/52TGPlQimFc/mqdefault.jpg", // image url of the thumbnail
}
Utility functions (not currently working)
// To edit the notifier's channel ID, or the message, If you don't wanna change one of the property just give undefined in its place
Notifier.editNotifier(youtubeId, channelID, message);
// To remove a notifier
Notifier.removeNotifier(youtubeId)
Support
for support or issues or queries contace me on my discord server.