2023-02-25 12:42:21 +00:00
|
|
|
const moove = require("./moove")
|
2023-02-25 12:53:19 +00:00
|
|
|
const help = require('./helpFunctions')
|
2023-02-25 12:42:21 +00:00
|
|
|
|
|
|
|
function gotMessage(message) {
|
|
|
|
if (message.author.bot) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
const content = message.content.trim()
|
|
|
|
const msgContentSplit = content.split(/[ ]+/)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reference can't be null => must be a reply to message
|
|
|
|
* must contain only one argument
|
|
|
|
* that argument mentions channel
|
|
|
|
*/
|
|
|
|
|
2023-02-25 12:53:19 +00:00
|
|
|
console.log(message.reference)
|
|
|
|
console.log(msgContentSplit.length)
|
|
|
|
console.log(message)
|
2023-02-25 12:42:21 +00:00
|
|
|
if (message.reference != null && msgContentSplit.length == 1 &&
|
|
|
|
message.mentions.channels.first() != undefined) {
|
2023-02-25 12:53:19 +00:00
|
|
|
console.log("aaaa")
|
2023-02-25 12:42:21 +00:00
|
|
|
moove(message, msgContentSplit[0])
|
|
|
|
}
|
|
|
|
|
|
|
|
const msg = message.content.toLowerCase()
|
|
|
|
|
|
|
|
const chance = help.RNG(50000)
|
|
|
|
if (chance == 420) {
|
|
|
|
whoAsked(message)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (msg.includes('henlo')) {
|
|
|
|
henlo(message)
|
|
|
|
}
|
|
|
|
else if (msg.includes('how ye')) {
|
|
|
|
mood(message)
|
|
|
|
}
|
|
|
|
else if (msg.includes('tylko jedno')) {
|
|
|
|
message.reply('Koksu pięć gram odlecieć sam')
|
|
|
|
}
|
|
|
|
|
|
|
|
if (process.env.DEBUG == "ON") {
|
|
|
|
const debugger_ = require('./.debug.js')
|
|
|
|
debugger_.debug(message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function henlo(message) {
|
|
|
|
const emojis = ['🥰', '🐄', '🐮', '❤️', '👋', '🤠', '😊'];
|
|
|
|
const randomNum = help.RNG(emojis.length);
|
|
|
|
message.reply('Henlooo ' + message.author.username + ' ' + emojis[randomNum]);
|
|
|
|
}
|
|
|
|
|
|
|
|
function mood(message) {
|
|
|
|
const responses = ['Not bad, how yee?', 'MOOdy', 'A bit sad 😢', 'Good, how yee?', 'I\'m fine, how yee?'];
|
|
|
|
const randomNum = help.RNG(responses.length);
|
|
|
|
message.reply(responses[randomNum]);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function whoAsked(message) {
|
|
|
|
if (message.embeds.length == 0 && message.attachments.size == 0 && message.content != '') {
|
|
|
|
const searchKey = 'who-asked';
|
|
|
|
const gifAmount = 20;
|
|
|
|
const gifs = `https://g.tenor.com/v1/search?q=${searchKey}&key=${process.env.TENOR}&limit=${gifAmount}`;
|
|
|
|
|
|
|
|
message.reply({ embeds: [await help.getGifEmbed(gifs, gifAmount)] });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = gotMessage;
|