Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Add TasteDive Command #1346

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a026a2
Add a Itunes command
puddingpy Oct 16, 2021
275d354
Add TasteDiv Command
puddingpy Oct 16, 2021
a367922
Merge branch 'dev' into tastediv
Doges Oct 16, 2021
27dd24f
Remove itunes.js
puddingpy Oct 16, 2021
5ee8cbe
Make requested changes
puddingpy Oct 18, 2021
79b23d1
Update src/locales/en-US/commands.json
puddingpy Oct 19, 2021
0f1dc6f
Update src/commands/misc/tastedive.js
puddingpy Oct 19, 2021
1455697
Make requested changes
puddingpy Oct 22, 2021
4ea475d
Formatting
puddingpy Oct 22, 2021
ddb8047
Remove unnecessary lines
puddingpy Oct 23, 2021
1a58986
Update src/apis/TasteDive.js
puddingpy Oct 23, 2021
ecb5cbd
Make requested changes
puddingpy Oct 25, 2021
8bbfa7f
Make requested changes
puddingpy Oct 25, 2021
33e978c
Update
puddingpy Oct 25, 2021
f50e05d
Make requested changes
puddingpy Oct 25, 2021
c6cf6e2
Make requested changes
puddingpy Oct 25, 2021
8167d27
Merge branch 'dev' into tastediv
Doges Oct 25, 2021
43dfe58
Make requested changes
puddingpy Oct 27, 2021
7fd126e
Revert unwanted changes
almeidx Oct 31, 2021
c9dba54
Update tastedive.js
almeidx Oct 31, 2021
b9d631e
Make requested changes
puddingpy Oct 31, 2021
04585c7
Make requested changes
puddingpy Oct 31, 2021
3d5c9fc
Make requested changes
puddingpy Oct 31, 2021
d7fcfae
Make requested changes
puddingpy Oct 31, 2021
f1bed8f
Make requested changes
puddingpy Oct 31, 2021
8b20ec6
Make requested changes
puddingpy Oct 31, 2021
b6855b6
Fix errors
puddingpy Oct 31, 2021
ef1a656
Fix errors
puddingpy Oct 31, 2021
7b852af
Update
puddingpy Oct 31, 2021
f333441
standard
almeidx Oct 31, 2021
20877b5
Merge branch 'dev' into tastediv
puddingpy Nov 13, 2021
61d84aa
Make requested changes
puddingpy Nov 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/commands/misc/tastediv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const { Command, SwitchbladeEmbed } = require('../../')
const fetch = require("node-fetch")
almeidx marked this conversation as resolved.
Show resolved Hide resolved

module.exports = class TasteDiv extends Command {
constructor(client) {
super({
name: 'tastediv',
aliases: ['tastediv'],
almeidx marked this conversation as resolved.
Show resolved Hide resolved
parameters: [{
type: 'string',
full: true,
clean: true,
missingError: 'commands:tastediv.noText'
almeidx marked this conversation as resolved.
Show resolved Hide resolved
}]
}, client)
}

async run({ channel, message }, text) {
text = text.split(" ")
almeidx marked this conversation as resolved.
Show resolved Hide resolved

const type = text.at(-1)

const liking = text.splice(0 , text.length - 1).join(" ")

const data = await fetch(`https://tastedive.com/api/similar?q=${liking}&type=${type}&limit=10`).then(res => res.json()).then(data => data)

const description = this.createDescription(data)

const embed = new SwitchbladeEmbed()
.setColor(this.embedColor)
.setTitle(type.toUpperCase() + ' - ' + liking.toUpperCase())
.setDescription(description)

channel.send(embed);
}

createDescription = (data) => {
This conversation was marked as resolved.
Show resolved Hide resolved
var description = ""

var count = 1

for(let key in data["Similar"]["Results"]){
description += `${count < 10 ? "0" + count.toString() : count}: ${data["Similar"]["Results"][key].Name}\n`

count += 1
}

if(count === 1){
description = "Not Found"
}

return description
}
}
18 changes: 18 additions & 0 deletions src/locales/en-US/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,24 @@
"commandUsage": "<text>",
"noText": "You have to give me some text to asciify!"
},
"itunes": {
"commandDescription": "Provides the content within the iTunes Store and Apple Books Store.",
"commandUsage": "<media> <term>",
"example": "s!itunes ebook Famous Five",
"subcommands": {
"media": {
"commandDescription": "Type of media. Examples: Ebook , Movie , PodCast",
"commandUsage": "media <term>"
}
},
"noText": "You have to give me media and search terms!"
},
almeidx marked this conversation as resolved.
Show resolved Hide resolved
"tastediv": {
almeidx marked this conversation as resolved.
Show resolved Hide resolved
"commandDescription": "Provides similar content related to your liking.",
"commandUsage": "<liking> <type>",
"example": "s!tastediv Far Cry 5 Game",
almeidx marked this conversation as resolved.
Show resolved Hide resolved
"noText": "You have to give me your liking and type!"
},
"hentai": {
"commandDescription": "Sends hentai in an NSFW channel.",
"hereIsYourHentai": "Here's your hentai!"
Expand Down