diff options
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | src/commands/bb.js | 28 | ||||
| -rw-r--r-- | src/commands/dark.js | 29 | ||||
| -rw-r--r-- | src/commands/got.js | 28 | ||||
| -rw-r--r-- | src/commands/jokes.js | 28 | ||||
| -rw-r--r-- | src/commands/loadout.js | 79 | ||||
| -rw-r--r-- | src/commands/play.js | 52 | ||||
| -rw-r--r-- | src/commands/radioStart.js | 54 | ||||
| -rw-r--r-- | src/commands/radioStop.js | 23 | ||||
| -rw-r--r-- | src/commands/stop.js | 17 | ||||
| -rw-r--r-- | src/commands/vaccine.js | 41 | ||||
| -rw-r--r-- | src/commons/confusion.js | 22 | ||||
| -rw-r--r-- | src/configs/commands.config.json | 42 | ||||
| -rw-r--r-- | src/language/language.json | 21 | ||||
| -rw-r--r-- | src/main.js | 33 | 
15 files changed, 100 insertions, 413 deletions
| @@ -1,8 +1,8 @@ -<h1 align="center">LULBOT</h1> +<h1 align="center">RADIO BOT</h1>  <p align="center">    <img src="assets/logo.png" alt="lul-bot-logo" width="120px" height="120px"/>    <br> -  <i>A Discord bot written for your server</i> +  <i>A Discord Radio bot written for your server</i>    <br>  </p>  <hr> @@ -20,11 +20,17 @@  Before running this project you must create a ```.env``` file which should contains the following keys (This can be changed in the source code)  <br>  ``` -LUL_BOT_TKN=Your_Discord_Bot_token -TENOR_TOKEN=Tenor_token // this used for generating gifs -AIRTABLE_KEY=Airtable_key // this is currently used to store data for my CoD mobile loadouts +RADIO_BOT_TKN=Your_Discord_Bot_token +RADIO_CHANNEL= A Voice Channel ID // this voice channel is used for playing music +NOW_PLAYING_CHANNEL=A Text Channel ID // this channel is used for displaying now playing notifications +ADMIN_ID = Admin User ID // This is the ID of the admin user who has permission to stop and start Radio  ``` +### Commands +``` +!radioStart // Command to start the Radio +!radioStop // Command to stop the radio +```  ### Credits  [CodeLyon][codelyon] - For discord.js getting started videos diff --git a/src/commands/bb.js b/src/commands/bb.js deleted file mode 100644 index bfd0c3a..0000000 --- a/src/commands/bb.js +++ /dev/null @@ -1,28 +0,0 @@ -const axios = require('axios').default; -const { MessageEmbed } = require('discord.js'); -const instance = axios.create({ -    baseURL: 'https://breaking-bad-quotes.herokuapp.com/v1' -}); - -async function getRandomQuotes(message, args) { -    const randomQuotesUrl = "/quotes"; -    try { -        const result = await instance.get(randomQuotesUrl); -        const { quote, author } = result.data[0]; -        const randomQuoteMessage = new MessageEmbed() -            .setDescription(quote) -            .setFooter(`${author}`); -        message.channel.send(randomQuoteMessage); -    } catch (error) { -        const errorMessage = new MessageEmbed() -            .setTitle("Stay out of territory: Error getting quotes from Walter White") -            .setColor("RED"); -        message.channel.send(errorMessage); -    } -} - -module.exports = { -    execute(client, message, args) { -        getRandomQuotes(message, args); -    } -}
\ No newline at end of file diff --git a/src/commands/dark.js b/src/commands/dark.js deleted file mode 100644 index 54a486d..0000000 --- a/src/commands/dark.js +++ /dev/null @@ -1,29 +0,0 @@ -const axios = require('axios').default; -const { MessageEmbed } = require('discord.js'); -const instance = axios.create({ -    baseURL: 'https://dark-api.herokuapp.com/api/v1' -}); - -async function getRandomQuotes(message, args) { -    const randomQuotesUrl = "/quote/random"; -    try { -        const result = await instance.get(randomQuotesUrl); -        const { author, season, episode, quote } = result.data; -        const randomQuoteMessage = new MessageEmbed() -            .setDescription(quote) -            .setFooter(`${author}, S${season} : Episode - ${episode}`); -        message.channel.send(randomQuoteMessage); -    } catch (error) { -        const errorMessage = new MessageEmbed() -            .setTitle("Something went wrong: Error getting quotes from Mikkel Nielsen") -            .setColor("RED"); -        message.channel.send(errorMessage); -    } -} - -module.exports = { -    execute(client, message, args) { -        getRandomQuotes(message, args); -    } -} - diff --git a/src/commands/got.js b/src/commands/got.js deleted file mode 100644 index bfb9295..0000000 --- a/src/commands/got.js +++ /dev/null @@ -1,28 +0,0 @@ -const axios = require('axios').default; -const { MessageEmbed } = require('discord.js'); -const instance = axios.create({ -    baseURL: 'https://game-of-thrones-quotes.herokuapp.com/v1' -}); - -async function getRandomQuotes(message, args) { -    const randomQuotesUrl = "/random"; -    try { -        const result = await instance.get(randomQuotesUrl); -        const { sentence, character: { name, house: { name: houseName } } } = result.data; -        const randomQuoteMessage = new MessageEmbed() -            .setDescription(sentence) -            .setFooter(`${name}, ${houseName}`); -        message.channel.send(randomQuoteMessage); -    } catch (error) { -        const errorMessage = new MessageEmbed() -            .setTitle("Something went wrong: Error getting quotes from Arya Stark") -            .setColor("RED"); -        message.channel.send(errorMessage); -    } -} - -module.exports = { -    execute(client, message, args) { -        getRandomQuotes(message, args); -    } -}
\ No newline at end of file diff --git a/src/commands/jokes.js b/src/commands/jokes.js deleted file mode 100644 index 578e51b..0000000 --- a/src/commands/jokes.js +++ /dev/null @@ -1,28 +0,0 @@ -const fetch = require('node-fetch'); - -function randomJokes(message) { -    message.channel.startTyping(); -    getJokes().then(response => { -        message.channel.stopTyping(); -        if (response) { -            message.channel.startTyping(); -            message.reply(response.setup); -            setTimeout(() => { -                message.channel.stopTyping(); -                message.reply(`||${response.punchline}||`); -            }, 5000); -        } -    }); -} - -async function getJokes() { -    return fetch(`https://official-joke-api.appspot.com/jokes/random`) -        .then(res => res.json()) -} - - -module.exports = { -    execute(client,message, args) { -        randomJokes(message); -    } -}
\ No newline at end of file diff --git a/src/commands/loadout.js b/src/commands/loadout.js deleted file mode 100644 index 7580e60..0000000 --- a/src/commands/loadout.js +++ /dev/null @@ -1,79 +0,0 @@ -const Airtable = require('airtable'); -const {MessageEmbed} = require('discord.js');  -Airtable.configure({ -    endpointUrl: 'https://api.airtable.com', -    apiKey: process.env.AIRTABLE_KEY -}); -const base = Airtable.base('appppieGLc8loZp5H'); -const AirTableConfigs = { -    MAIN_TABLE: 'cod_loadout', -    WEAPONS_TYPE_TABLE: 'Weapon Types', -    WEAPONS_TABLE: 'Weapons', -    GRID_VIEW: 'Grid view', -    WEAPON_TYPE: 'cod_weapon_type', -    WEAPON_NAME: 'cod_weapon_name', -    MATCH_TYPE: 'cod_match_type', -    ATTACHMENTS: 'cod_weapon_attachments', -}; - -async function getCodMLoadOut(message, args) { -    const codUserName = args[0]; -    if (!codUserName) return; -    base(AirTableConfigs.MAIN_TABLE).select({ -        maxRecords: 2, -        view: AirTableConfigs.GRID_VIEW, -        filterByFormula: `({cod_username} = '${args[0]}')` -    }).eachPage((records, fetchNextPage) => { -        if (records && records.length > 0) { -            records.forEach(async (record) => { -                const weaponType = await getWeaponType(record.get(AirTableConfigs.WEAPON_TYPE)); -                const weaponName = await getWeaponName(record.get(AirTableConfigs.WEAPON_NAME)); -                const loadOutMessage = new MessageEmbed() -                    .setTitle(`Loadout of ${codUserName} : ${record.get(AirTableConfigs.MATCH_TYPE)}`) -                    .addField('Weapon Name', weaponName, true) -                    .addField('Weapon Type', weaponType, true) -                    .addField('Attachments', record.get(AirTableConfigs.ATTACHMENTS), true) -                    .setColor("RANDOM"); -                message.channel.send(loadOutMessage); -            }); -            fetchNextPage(); -        } else { -            message.channel.send(`No Loadout found for ***${codUserName}***`); -        } - -    }, function done(err) { -        if (err) { console.error(err); return; } -    }); -} - -async function getWeaponType(weaponType) { -    return new Promise((resolve, reject) => { -        base(AirTableConfigs.WEAPONS_TYPE_TABLE).find(weaponType, (error, record) => { -            if (error) { -                console.log(error); -                reject(); -            } else { -                resolve(record.get(AirTableConfigs.WEAPON_TYPE)); -            } -        }); -    }) -} - -async function getWeaponName(weaponName) { -    return new Promise((resolve, reject) => { -        base(AirTableConfigs.WEAPONS_TABLE).find(weaponName, (error, record) => { -            if (error) { -                console.log(error); -                reject(); -            } else { -                resolve(record.get(AirTableConfigs.WEAPON_NAME)); -            } -        }); -    }) -} - -module.exports = { -    execute(client,message, args) { -        getCodMLoadOut(message,args); -    } -}
\ No newline at end of file diff --git a/src/commands/play.js b/src/commands/play.js deleted file mode 100644 index 9c2d7a3..0000000 --- a/src/commands/play.js +++ /dev/null @@ -1,52 +0,0 @@ -const ytdl = require('ytdl-core'); -const ytSearch = require('yt-search'); -async function playMusik(client, message, args) { -    const voiceChannel = message.member.voice.channel; -    if (!voiceChannel) { -        return message.channel.send("Join a voice channel to Play Music"); -    } -    const permission = voiceChannel.permissionsFor(message.client.user); -    if (!permission.has('CONNECT') || !permission.has('SPEAK')) { -        return message.channel.send("You don't have the permission to play music. ๐ฅ"); -    } - -    if (!args.length) { -        return message.channel.send("Please pass something to play as second argument"); -    } - -    const connection = await voiceChannel.join(); -    let videoUrl = false; -    let video; -    const youtubeRegex = /(http:|https:)?\/\/(www\.)?(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/;  -    if (youtubeRegex.test(args[0])) { -        video = args[0]; -        videoUrl = true; -    } else { -        video = await searchVideo(args.join(' ')); -    } - -    if (video) { -        const youtubeStream = ytdl(videoUrl ? video : video.url, { filter: 'audioonly' }); -        client.user.setPresence({ activity: { name: `${video.title}`, type: 'LISTENING' } }); -        connection.play(youtubeStream, { seek: 0, volume: 1 }) -            .on('finish', () => { -                voiceChannel.leave(); -                client.user.setPresence({ activity: { name: ` ` } }); -            }); -        await message.reply(`Now Playing ${videoUrl ? args[0] : video.title}...`); -    } else { -        message.channel.send("No music found to play for you mate. Try again! ๐"); -    } -} - -async function searchVideo(query) { -    const searchResult = await ytSearch(query); -    return (searchResult.videos.length > 1) ? searchResult.videos[0] : null; -} - - -module.exports = { -    execute(client,message, args) { -        playMusik(client,message,args); -    } -}
\ No newline at end of file diff --git a/src/commands/radioStart.js b/src/commands/radioStart.js new file mode 100644 index 0000000..d9c4ac1 --- /dev/null +++ b/src/commands/radioStart.js @@ -0,0 +1,54 @@ +const { VoiceChannel, TextChannel, MessageEmbed } = require("discord.js"); +const axios = require('axios').default; + +const instance = axios.create({ +    baseURL: 'http://retrowave.ru/api/v1' +}); + +const resourceUrl = 'http://retrowave.ru' + +async function broadcastRadio(client, args, message, voiceChannel, textChannel) { +    const connection = await voiceChannel.join(); +    try { +        playRadio(connection, textChannel); +    } catch (error) { +        console.log(error); +        textChannel.send('Something went wrong. RADIO MON got ill...๐ฑ๐ฑ'); +    } + +} + +async function playRadio(connection,textChannel) { +    const nextMusic = await getNextMusic(); +    const { id, title, streamUrl, artworkUrl } = nextMusic; +    const nowPlayingMessage = new MessageEmbed() +        .setTitle("Now Playing") +        .setDescription(title) +        .setColor('LUMINOUS_VIVID_PINK') +        .setThumbnail(`${resourceUrl}${artworkUrl}`); +    textChannel.send(nowPlayingMessage) +    connection.play(`${resourceUrl}${streamUrl}`, { seek: 0, volume: 1 }) +        .on('finish', () => { +            playRadio(connection,textChannel); +        }); +} + +async function getNextMusic() { +    const result = await instance.get('/tracks?cursor=1&limit=1'); +    return result.data.body.tracks[0]; +} + +module.exports = { +    async execute(client, message, args) { +        const { RADIO_CHANNEL, NOW_PLAYING_CHANNEL } = process.env; +        if (!RADIO_CHANNEL) return message.reply(`Please add RADIO_CHANNEL to .env with a Voice Channel ID`); +        if (!NOW_PLAYING_CHANNEL) return message.reply(`Please add NOW_PLAYING_CHANNEL to .env with a Text Channel ID`); + +        const voiceChannel = await client.channels.fetch(process.env.RADIO_CHANNEL); +        const nowPlayingChannel = await client.channels.fetch(process.env.NOW_PLAYING_CHANNEL); +        if (!(voiceChannel instanceof VoiceChannel)) return message.reply(`Please provice a Voice Channel ID to the RADIO_CHANNEL`); +        if (!(nowPlayingChannel instanceof TextChannel)) return message.reply(`Please provice a Text Channel ID to the NOW_PLAYING_CHANNEL`); + +        broadcastRadio(client, args, message, voiceChannel, nowPlayingChannel); +    } +}
\ No newline at end of file diff --git a/src/commands/radioStop.js b/src/commands/radioStop.js new file mode 100644 index 0000000..8d5786d --- /dev/null +++ b/src/commands/radioStop.js @@ -0,0 +1,23 @@ +const { VoiceChannel, TextChannel } = require("discord.js"); + +async function stopRadioBroadcast(client, args, message, voiceChannel, textChannel) { +    if (voiceChannel) { +        await voiceChannel.leave(); +        textChannel.send('RADIO Stopped'); +    } +} + +module.exports = { +    async execute(client, message, args) { +        const { RADIO_CHANNEL, NOW_PLAYING_CHANNEL } = process.env; +        if (!RADIO_CHANNEL) return message.reply(`Please add RADIO_CHANNEL to .env with a Voice Channel ID`); +        if (!NOW_PLAYING_CHANNEL) return message.reply(`Please add NOW_PLAYING_CHANNEL to .env with a Text Channel ID`); + +        const voiceChannel = await client.channels.fetch(process.env.RADIO_CHANNEL); +        const nowPlayingChannel = await client.channels.fetch(process.env.NOW_PLAYING_CHANNEL); +        if (!(voiceChannel instanceof VoiceChannel)) return message.reply(`Please provice a Voice Channel ID to the RADIO_CHANNEL`); +        if (!(nowPlayingChannel instanceof TextChannel)) return message.reply(`Please provice a Text Channel ID to the NOW_PLAYING_CHANNEL`); + +        stopRadioBroadcast(client, args, message, voiceChannel, nowPlayingChannel); +    } +}
\ No newline at end of file diff --git a/src/commands/stop.js b/src/commands/stop.js deleted file mode 100644 index 0c5e3df..0000000 --- a/src/commands/stop.js +++ /dev/null @@ -1,17 +0,0 @@ -async function stopMusik(client,message) { -    const voiceChannel = message.member.voice.channel; - -    if (!voiceChannel) { -        return message.channel.send("Join a voice channel to Execute this command"); -    } - -    await voiceChannel.leave(); -    await message.channel.send("Stoping Music... Baye Baye.... ๐
"); -    client.user.setPresence({ activity: { name: `COMMANDS`, type: 'LISTENING' } }); -} - -module.exports = { -    execute(client,message, args) { -        stopMusik(client, message); -    } -}
\ No newline at end of file diff --git a/src/commands/vaccine.js b/src/commands/vaccine.js deleted file mode 100644 index e1219f2..0000000 --- a/src/commands/vaccine.js +++ /dev/null @@ -1,41 +0,0 @@ -const axios = require('axios').default; -const {MessageEmbed} = require('discord.js');  -const instance = axios.create({ -    baseURL: 'https://cdn-api.co-vin.in/api/v2', -    headers: { -        'accept': '*/*', -        'accept-language': 'en-US', -        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' -    } -  }); -async function getVaccineAvailablity(message, args) { -    const [pincode, date] = args; -    const url = `/appointment/sessions/public/findByPin?${new URLSearchParams({ pincode, date })}`; -    instance.get(url).then(res => { -        if (res.data && res.data.sessions) { -            const {sessions} = res.data; -            if (sessions && sessions.length > 0 ){ -                sessions.forEach(async (session) => { -                    const vaccineMessage = new MessageEmbed() -                        .setTitle(`${session.name} : ${session.address}`) -                        .addField('State', session.state_name, true) -                        .addField('District', session.district_name, true) -                        .addField('Vaccine', session.vaccine, true) -                        .addField('Available Capacity', session.available_capacity, true) -                        .addField('Available SLots', session.slots.join("/"), true) -                        .setColor("RANDOM"); -                    message.channel.send(vaccineMessage); -                }) - -            }else { -                message.channel.send(`No Vaccine Available at place with pincode => ${pincode} on ${date}`) -            } -        } -    }).catch(error =>  message.channel.send(`Error Fetching Data from Cowin`)); -} - -module.exports = { -    execute(client, message, args) { -        getVaccineAvailablity(message, args); -    } -}
\ No newline at end of file diff --git a/src/commons/confusion.js b/src/commons/confusion.js deleted file mode 100644 index 7a5d9b8..0000000 --- a/src/commons/confusion.js +++ /dev/null @@ -1,22 +0,0 @@ -const {MessageEmbed} = require('discord.js'); -const fetch = require('node-fetch'); -function generateConfusionGif(message) { -    message.channel.startTyping(); -    const embed = new MessageEmbed() -        .setDescription(`I dont understand what you are saying <@${process.env.KLIAS_TAG}> do you know what this guy is asking?`) -        .setColor("RANDOM"); -    const randomIndex = Math.floor(Math.random() * 49); -    fetch(`https://api.tenor.com/v1/random?key=${process.env.TENOR_TOKEN}&q=I%20dont%20understand&limit=50`) -        .then(res => res.json()) -        .then(response => { -            embed.setImage(response.results[randomIndex].media[0].gif.url); -            message.channel.stopTyping(); -            message.channel.send(embed); -        }); -} - -module.exports = { -    execute(message) { -        generateConfusionGif(message); -    } -}
\ No newline at end of file diff --git a/src/configs/commands.config.json b/src/configs/commands.config.json index af4da0d..cdb7745 100644 --- a/src/configs/commands.config.json +++ b/src/configs/commands.config.json @@ -1,44 +1,14 @@  {      "commands" :[          { -            "name": "jokes", -            "description": "Bad Jokes Command", -            "file": "./commands/jokes.js" +            "name": "radioStart", +            "description": "Start Radio", +            "file": "./commands/radioStart.js"          },          { -            "name": "play", -            "description": "Play Music", -            "file": "./commands/play.js" -        }, -        { -            "name": "stop", -            "description": "Stop Music", -            "file": "./commands/stop.js" -        }, -        { -            "name": "loadout", -            "description": "Get CoD Mobile User Loadout", -            "file": "./commands/loadout.js" -        }, -        { -            "name": "vaccine", -            "description": "Get Vaccine Availability by Pincode", -            "file": "./commands/vaccine.js" -        }, -        { -            "name": "got", -            "description": "Game of Thrones Quotes", -            "file": "./commands/got.js" -        }, -        { -            "name": "bb", -            "description": "Breaking Bad Quotes", -            "file": "./commands/bb.js" -        }, -        { -            "name": "dark", -            "description": "Dark Series Quotes", -            "file": "./commands/dark.js" +            "name": "radioStop", +            "description": "Stop Radio", +            "file": "./commands/radioStop.js"          }      ]  }
\ No newline at end of file diff --git a/src/language/language.json b/src/language/language.json index c788513..9e26dfe 100644 --- a/src/language/language.json +++ b/src/language/language.json @@ -1,20 +1 @@ -{ -    "hi": "Hey ๐โโ๏ธ. How Are You?", -    "hello": "Hey ๐โโ๏ธ. How Are You?", -    "เดนเดฒเต": "เดนเดฒเตเดฒเดพ.... เดเดคเดพเดฐเดพ.. เดธเตเดเด เดคเดจเตเดจเต?", -    "เดนเดฟ": "เดนเดฒเตเดฒเดพ.... เดเดคเดพเดฐเดพ.. เดธเตเดเด เดคเดจเตเดจเต?", -    "เดเดจเตเดคเตเดเตเดเต เดเดฃเตเดเต เดตเดฟเดถเตเดทเด": "เด
เดเตเดเดฟเดจเต เดชเตเดฃเต...๐คทโโ๏ธ เดธเตเดเดเตเดเดณเตเดเตเดเต เดคเดจเตเดจเต?", -    "enthokke und vishesham": "เด
เดเตเดเดฟเดจเต เดชเตเดฃเต...๐คทโโ๏ธ เดธเตเดเดเตเดเดณเตเดเตเดเต เดคเดจเตเดจเต?", -    "เดฎเดจเตเดธเตเดธเดจเดฒเตเดฒเต เดชเตเดณเตเดณเต": "เดเดฑเดเตเดเดฟเดฏเตเด เดฌเดฑเตเดเตเดเดฏเตเด เดตเตเดฃเดพเดฏเดฟเดฐเดฟเดเตเดเตเด... ๐คฃ๐คฃ๐คฃ", -    "manusanalle pulle": "เดเดฑเดเตเดเดฟเดฏเตเด เดฌเดฑเตเดเตเดเดฏเตเด เดตเตเดฃเดพเดฏเดฟเดฐเดฟเดเตเดเตเด... ๐คฃ๐คฃ๐คฃ", -    "เดจเต เดเดฐเดพ": "เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต เดคเดจเดฟเดเตเดเต เด
เดฑเดฟเดฏเดพเดจเตเดฎเตเดฒเตเดเตเดเดฟเตฝ เดคเดพเตป เดเดจเตเดจเตเดเต เดเตเดฏเตเดเตเดเต เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต??? เดคเดจเดฟเดเตเดเต เดเดพเตป เดชเดฑเดเตเดเต เดคเดฐเดพเด เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต... ๐คช๐คช", -    "nee araa": "เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต เดคเดจเดฟเดเตเดเต เด
เดฑเดฟเดฏเดพเดจเตเดฎเตเดฒเตเดเตเดเดฟเตฝ เดคเดพเตป เดเดจเตเดจเตเดเต เดเตเดฏเตเดเตเดเต เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต??? เดคเดจเดฟเดเตเดเต เดเดพเตป เดชเดฑเดเตเดเต เดคเดฐเดพเด เดคเดพเตป เดเดฐเดพเดฃเตเดจเตเดจเต... ๐คช๐คช", -    "kya banana hei": "Thumarah banana kaha hei...๐คฃ๐คฃ", -    "เดเตเดฏเดพ เดฌเดจเดพเดจ เดนเตเดฏเต": "เดคเตเดฎเดฐเดนเต เดฌเดจเดพเดจ เดเดนเดพ เดนเตเดฏเต...๐คฃ๐คฃ", -    "good night": "Good Night ๐. See you tomorrow. ๐๐", -    "ola": "เดเดฒ เด
เดฒเตเดฒ เดคเตเดเตเดเดพ", -    "เด
เดเตเดเดฟเดจเต เดชเดฑเดฏเดพเดคเต": "เดชเดฟเดจเตเดจเต เดเดเตเดเดฟเดจเต เดชเดฑเดฏเดฃเด!!", -    "kool": "เดเดคเตเดฐเต เดกเดฟเดเตเดฐเต เดเดฃเตเดเต? ๐คฃ๐คฃ", -    "cool": "เดเดคเตเดฐเต เดกเดฟเดเตเดฐเต เดเดฃเตเดเต? ๐คฃ๐คฃ", -    "adipoli": "เดฎเต เดฎเต" -}
\ No newline at end of file +{}
\ No newline at end of file diff --git a/src/main.js b/src/main.js index d0bb7d6..1685d3d 100644 --- a/src/main.js +++ b/src/main.js @@ -1,32 +1,23 @@  require('dotenv').config();  const fs = require('fs');  const { Client, Collection } = require('discord.js'); -const confusion = require('./commons/confusion'); +const { env } = require('process');  const client = new Client();  client.commands = new Collection(); -let casualMessages = {};  const CMD_PREFIX = "!";  client.on('message', (message) => {      if (message.author.bot) return; +    if(message.author.id !== process.env.ADMIN_ID) return;      if (message.content.startsWith(CMD_PREFIX)) {          const commandReply = parseCMD(message); -        if (!commandReply) { -            confusion.execute(message); -        } -    } else { -        const replyMessage = parseCasualMessage(message); -        if (replyMessage) { -            message.reply(replyMessage); -        } -    } +    }   });  client.on('ready', () => { -    console.log("BOT is now LIVE"); +    console.log("RADIO BOT is now LIVE");      initConfig(); -    initLanguages();  })  function initConfig() { @@ -42,20 +33,6 @@ function initConfig() {      })  } -function initLanguages() { -    fs.readFile('src/language/language.json', 'utf8', (error, data) => { -        if (error) throw error; -        casualMessages = JSON.parse(data); -    }); -} - -function parseCasualMessage(message) { -    const { content } = message; -    const parsedMessage = content.trim().toLowerCase(); -    if (!casualMessages.hasOwnProperty(parsedMessage)) return null; -    return casualMessages[parsedMessage]; -} -  function parseCMD(message) {      const [CMD_NAME, ...args] = message.content          .trim() @@ -73,7 +50,7 @@ function parseCMD(message) {      return true;  } -client.login(process.env.LUL_BOT_TKN) +client.login(process.env.RADIO_BOT_TKN)      .catch((error) => {          console.error("BOT Login Failed ", error);      }); | 
