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( 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((res) => res.json())
.then((data) => { .then((data) => {

View file

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

View file

@ -8,7 +8,7 @@ const command = {
if (splitted[2]) channel = splitted[2]; if (splitted[2]) channel = splitted[2];
const data = await fetch( 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((res) => res.json())
.then((data) => { .then((data) => {

View file

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

View file

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

View file

@ -13,9 +13,9 @@ const command = {
} }
const data = await fetch( 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] splitted[2]
}&text=${splitted.slice(3).join(" ")}` )}&text=${encodeURIComponent(splitted.slice(3).join(" "))}`
) )
.then((res) => res.json()) .then((res) => res.json())
.catch((err) => console.log(err)); .catch((err) => console.log(err));

View file

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

View file

@ -13,7 +13,7 @@ const command = {
} }
const data = await fetch( 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((res) => res.json())
.then((data) => { .then((data) => {

View file

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