encodeuricomponent

This commit is contained in:
Joonas 2023-02-06 16:02:34 +02:00
parent 9f8a3c2e1f
commit a883912233
9 changed files with 18 additions and 33 deletions

View File

@ -13,7 +13,9 @@ const command = {
}
const data = await fetch(
`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${splitted[2]}&api_key=${process.env.LASTFM_KEY}&format=json&limit=1`
`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${encodeURIComponent(
splitted[2]
)}&api_key=${process.env.LASTFM_KEY}&format=json&limit=1`
)
.then((res) => res.json())
.then((data) => {

View File

@ -5,12 +5,9 @@ const command = {
mod: false,
run: async (client, msg, splitted) => {
const data = await fetch(
`https://librex.nekus.gay/api.php?q="${splitted
.slice(2)
.join(" ")
.replaceAll("\\", "")
.replaceAll("/", "")
.replaceAll("&", "")}"`
`https://librex.nekus.gay/api.php?q="${encodeURIComponent(
splitted.slice(2).join(" ")
)}"`
)
.then((res) => res.json())
.then((data) => data[0])

View File

@ -8,7 +8,7 @@ const command = {
if (splitted[2]) channel = splitted[2];
const data = await fetch(
`https://tmi.twitch.tv/group/user/${channel}/chatters`
`https://tmi.twitch.tv/group/user/${encodeURIComponent(channel)}/chatters`
)
.then((res) => res.json())
.then((data) => {

View File

@ -5,13 +5,9 @@ const command = {
mod: false,
run: async (client, msg, splitted) => {
const data = await fetch(
`https://quetre.iket.me/api/v1/search?q=${splitted
.slice(2)
.join(" ")
.replaceAll("?", "")
.replaceAll("/", "")
.replaceAll("\\", "")
.replaceAll("&", "")}&type=answer`
`https://quetre.iket.me/api/v1/search?q=${encodeURIComponent(
splitted.slice(2).join(" ")
)}&type=answer`
)
.then((res) => res.json())
.then((data) => data.data.results[0].text)

View File

@ -6,7 +6,7 @@ const command = {
run: async (client, msg, splitted) => {
const data = await fetch(
`https://teddit.namazso.eu/r/${
splitted[2] ? splitted[2].replaceAll(/\W/g, "") : "forsen"
splitted[2] ? encodeURIComponent(splitted[2]) : "forsen"
}?api`
)
.then((res) => res.json())

View File

@ -13,9 +13,9 @@ const command = {
}
const data = await fetch(
`https://simplytranslate.pussthecat.org/api/translate/?engine=google&to=${
`https://simplytranslate.pussthecat.org/api/translate/?engine=google&to=${encodeURIComponent(
splitted[2]
}&text=${splitted.slice(3).join(" ")}`
)}&text=${encodeURIComponent(splitted.slice(3).join(" "))}`
)
.then((res) => res.json())
.catch((err) => console.log(err));

View File

@ -6,13 +6,7 @@ const command = {
run: async (client, msg, splitted) => {
const data = await fetch(
`https://api.rss2json.com/v1/api.json?rss_url=https://nitter.namazso.eu/${
splitted[2]
? splitted[2]
.replaceAll("?", "")
.replaceAll("/", "")
.replaceAll("\\", "")
.replaceAll("&", "")
: "forsen"
splitted[2] ? encodeURIComponent(splitted[2]) : "forsen"
}/rss`
)
.then((res) => res.json())

View File

@ -13,7 +13,7 @@ const command = {
}
const data = await fetch(
`https://wttr.in/${splitted[2].replaceAll(/\W/g, "")}?format=j1`
`https://wttr.in/${encodeURIComponent(splitted[2])}?format=j1`
)
.then((res) => res.json())
.then((data) => {

View File

@ -12,13 +12,9 @@ const command = {
}
const data = await fetch(
`https://invidious.epicsite.xyz/api/v1/search?type=video&q=${splitted
.slice(2)
.join(" ")
.replaceAll("?", "")
.replaceAll("/", "")
.replaceAll("\\", "")
.replaceAll("&", "")}`
`https://invidious.epicsite.xyz/api/v1/search?type=video&q=${encodeURIComponent(
splitted.slice(2).join(" ")
)}`
)
.then((res) => res.json())
.then((data) => data[0])