wrzucamy śmietnik :DDDD
This commit is contained in:
parent
6d3524eed5
commit
cded4e036a
10 changed files with 2296 additions and 0 deletions
16
commands/dcstatus.js
Normal file
16
commands/dcstatus.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
module.exports = {
|
||||
data: {
|
||||
"name": 'dcstatus',
|
||||
"usage": '',
|
||||
"description": 'Check if Discord is working.'
|
||||
},
|
||||
async execute(event, bot) {
|
||||
const response = await fetch('https://discordstatus.com/api/v2/status.json');
|
||||
if (!response.ok) {
|
||||
event.reply("Failed to download status!")
|
||||
} else {
|
||||
const json = await response.json()
|
||||
event.reply(`${json.status.description}: ${json.page.url}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
39
commands/slavista.js
Normal file
39
commands/slavista.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
const sanitizeHtml = require('sanitize-html')
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
"name": 'slavista',
|
||||
"usage": '',
|
||||
"description": 'Sends latest fediverse post made by slavistapl.'
|
||||
},
|
||||
async execute(event, bot) {
|
||||
const response = await fetch('https://500plus.slavistapl.eu.org/api/v1/accounts/AajrBXKHPBH47ggKFU/statuses?exclude_replies=false&with_muted=true');
|
||||
if (!response.ok) {
|
||||
event.reply("Couldn't fetch posts...")
|
||||
} else {
|
||||
const json = await response.json()
|
||||
let i = 0
|
||||
let done = false
|
||||
|
||||
do {
|
||||
if (i > json.length) {
|
||||
event.reply("Couldn't fetch posts...")
|
||||
done = true
|
||||
} else {
|
||||
if (json[i].content == "" && json[i].media_attachments.length == 0) {
|
||||
i++
|
||||
} else {
|
||||
let str = sanitizeHtml(`${json[i].content.toString()} | ${json[i].uri}`, {
|
||||
allowedTags: ['a'],
|
||||
allowedAttributes: {
|
||||
'a': ['href']
|
||||
}
|
||||
})
|
||||
event.reply(str)
|
||||
done = true
|
||||
}
|
||||
}
|
||||
} while (!done)
|
||||
}
|
||||
}
|
||||
}
|
||||
14
commands/twojastara.js
Normal file
14
commands/twojastara.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
const fs = require('node:fs')
|
||||
const twojaStara = fs.readFileSync('./twojastara.txt').toString().split('\n')
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
"name": 'twojastara',
|
||||
"usage": '',
|
||||
"description": 'Sends a random "Twoja Stara" (Yo Mamma) joke.'
|
||||
},
|
||||
async execute(event, bot) {
|
||||
let num = Math.floor(Math.random() * twojaStara.length)
|
||||
event.reply(twojaStara[num])
|
||||
}
|
||||
}
|
||||
49
commands/wpedia.js
Normal file
49
commands/wpedia.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
const wikijs = require('wikijs').default
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
"name": 'wpedia',
|
||||
"usage": '<language code> <query>',
|
||||
"description": 'Search for Wikipedia articles.'
|
||||
},
|
||||
async execute(event, bot) {
|
||||
let query = event.message.split(`${bot.prefix}wpedia `)[1].toString().split(' ')
|
||||
if (!query) {
|
||||
event.reply(`Usage: ${bot.prefix}wpedia <language code> <query>`)
|
||||
} else {
|
||||
let lang = query.shift()
|
||||
if (!query) { // since query can be empty now, we need to check again
|
||||
event.reply(`Usage: ${bot.prefix}wpedia <language code> <query>`)
|
||||
} else {
|
||||
try {
|
||||
let okToContinue = false
|
||||
try {
|
||||
let connTest = await fetch(`https://${lang}.wikipedia.org/w/api.php`)
|
||||
console.log(connTest)
|
||||
okToContinue = true
|
||||
} catch (err) {
|
||||
okToContinue = false
|
||||
event.reply(`Oops, something went wrong... Is the language code correct?`)
|
||||
}
|
||||
|
||||
if (okToContinue) {
|
||||
let wiki = wikijs({
|
||||
apiUrl: `https://${lang}.wikipedia.org/w/api.php`
|
||||
})
|
||||
query = query.join(' ')
|
||||
wiki.search(query).then(async res => {
|
||||
if (!res['results'][0]) return event.reply("Sorry, couldn't find anything...")
|
||||
wiki.page(res['results'][0]).then(async page => {
|
||||
let info = await page.summary()
|
||||
event.reply(`${info.split('\n')[0]} https://${lang}.wikipedia.org/wiki/${res['results'][0].replace(/ /g, "_")}`)
|
||||
})
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
event.reply(`Oops, something went wrong... Is the language code correct?`)
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
commands/yt.js
Normal file
23
commands/yt.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const config = require('../config.json')
|
||||
const YouTube = require('simple-youtube-api')
|
||||
const youtube = new YouTube(config.youtube.token)
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
"name": 'yt',
|
||||
"usage": '<query>',
|
||||
"description": 'Search for YouTube videos.'
|
||||
},
|
||||
async execute(event, bot) {
|
||||
let query = event.message.split(`${bot.prefix}yt `)[1]
|
||||
if (!query) {
|
||||
event.reply(`Usage: ${bot.prefix}yt <query>`)
|
||||
} else {
|
||||
youtube.searchVideos(query, 1)
|
||||
.then(results => {
|
||||
if (!results[0]) return event.reply("Sorry, couldn't find anything...")
|
||||
event.reply(results[0].url)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue