misc.mcserver: actually check thhat we have an image to upload
This commit is contained in:
parent
3d600c8c9a
commit
2499ce6b36
1 changed files with 37 additions and 44 deletions
|
@ -25,8 +25,7 @@ yt.callback = async function (msg, line) {
|
||||||
if (!line) return "Arguments are required.";
|
if (!line) return "Arguments are required.";
|
||||||
|
|
||||||
const req = await fetch(
|
const req = await fetch(
|
||||||
`https://www.googleapis.com/youtube/v3/search?key=${
|
`https://www.googleapis.com/youtube/v3/search?key=${hf.apikeys.google
|
||||||
hf.apikeys.google
|
|
||||||
}&maxResults=5&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
}&maxResults=5&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
||||||
).then((x) => x.json());
|
).then((x) => x.json());
|
||||||
|
|
||||||
|
@ -59,8 +58,7 @@ fyt.callback = async function (msg, line) {
|
||||||
if (!line) return "Arguments are required.";
|
if (!line) return "Arguments are required.";
|
||||||
|
|
||||||
const req = await fetch(
|
const req = await fetch(
|
||||||
`https://www.googleapis.com/youtube/v3/search?key=${
|
`https://www.googleapis.com/youtube/v3/search?key=${hf.apikeys.google
|
||||||
hf.apikeys.google
|
|
||||||
}&maxResults=2&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
}&maxResults=2&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
||||||
).then((x) => x.json());
|
).then((x) => x.json());
|
||||||
|
|
||||||
|
@ -116,8 +114,7 @@ wolfram.callback = async function (msg, line, args, {verbose, v}) {
|
||||||
for (const x in extra) {
|
for (const x in extra) {
|
||||||
embed.fields.push({
|
embed.fields.push({
|
||||||
name: extra[x].title,
|
name: extra[x].title,
|
||||||
value: `[${
|
value: `[${extra[x].subpods[0].plaintext.length > 0
|
||||||
extra[x].subpods[0].plaintext.length > 0
|
|
||||||
? extra[x].subpods[0].plaintext
|
? extra[x].subpods[0].plaintext
|
||||||
: "<click for image>"
|
: "<click for image>"
|
||||||
}](${extra[x].subpods[0].img.src})`,
|
}](${extra[x].subpods[0].img.src})`,
|
||||||
|
@ -185,8 +182,7 @@ gimg.callback = async function (msg, line) {
|
||||||
url: image.url,
|
url: image.url,
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
text: `Image ${Number(index) + 1}/${
|
text: `Image ${Number(index) + 1}/${images.length
|
||||||
images.length
|
|
||||||
}. Rerun to get a different image.`,
|
}. Rerun to get a different image.`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -263,10 +259,8 @@ vote.callback = async function (msg, line, topic, {maybe}) {
|
||||||
topic = topic.join(" ");
|
topic = topic.join(" ");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: `**${msg.author.username}#${
|
content: `**${msg.author.username}#${msg.author.discriminator
|
||||||
msg.author.discriminator
|
}** has started a vote:\n## __${topic}__\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
||||||
}** has started a vote:\n## __${topic}__\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
|
|
||||||
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
|
||||||
}`,
|
}`,
|
||||||
addReactions: [
|
addReactions: [
|
||||||
":ms_tick:503341995348066313",
|
":ms_tick:503341995348066313",
|
||||||
|
@ -529,8 +523,7 @@ generate.callback = async function (msg, line) {
|
||||||
const title = `Responses for "${safeString(line)}"`;
|
const title = `Responses for "${safeString(line)}"`;
|
||||||
|
|
||||||
const out = {
|
const out = {
|
||||||
content: `Generated in ${formatTime(Date.now() - start)}${
|
content: `Generated in ${formatTime(Date.now() - start)}${retries > 0 ? " with " + retries + " retries" : ""
|
||||||
retries > 0 ? " with " + retries + " retries" : ""
|
|
||||||
}`,
|
}`,
|
||||||
embeds: [],
|
embeds: [],
|
||||||
files: images,
|
files: images,
|
||||||
|
@ -851,7 +844,7 @@ mcserver.callback = async function (msg, line) {
|
||||||
url: "attachment://icon.png",
|
url: "attachment://icon.png",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
file: {
|
file: image && {
|
||||||
file: image,
|
file: image,
|
||||||
name: "icon.png",
|
name: "icon.png",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue