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.";
|
||||
|
||||
const req = await fetch(
|
||||
`https://www.googleapis.com/youtube/v3/search?key=${
|
||||
hf.apikeys.google
|
||||
`https://www.googleapis.com/youtube/v3/search?key=${hf.apikeys.google
|
||||
}&maxResults=5&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
||||
).then((x) => x.json());
|
||||
|
||||
|
@ -59,8 +58,7 @@ fyt.callback = async function (msg, line) {
|
|||
if (!line) return "Arguments are required.";
|
||||
|
||||
const req = await fetch(
|
||||
`https://www.googleapis.com/youtube/v3/search?key=${
|
||||
hf.apikeys.google
|
||||
`https://www.googleapis.com/youtube/v3/search?key=${hf.apikeys.google
|
||||
}&maxResults=2&part=snippet&type=video&q=${encodeURIComponent(line)}`
|
||||
).then((x) => x.json());
|
||||
|
||||
|
@ -116,8 +114,7 @@ wolfram.callback = async function (msg, line, args, {verbose, v}) {
|
|||
for (const x in extra) {
|
||||
embed.fields.push({
|
||||
name: extra[x].title,
|
||||
value: `[${
|
||||
extra[x].subpods[0].plaintext.length > 0
|
||||
value: `[${extra[x].subpods[0].plaintext.length > 0
|
||||
? extra[x].subpods[0].plaintext
|
||||
: "<click for image>"
|
||||
}](${extra[x].subpods[0].img.src})`,
|
||||
|
@ -185,8 +182,7 @@ gimg.callback = async function (msg, line) {
|
|||
url: image.url,
|
||||
},
|
||||
footer: {
|
||||
text: `Image ${Number(index) + 1}/${
|
||||
images.length
|
||||
text: `Image ${Number(index) + 1}/${images.length
|
||||
}. Rerun to get a different image.`,
|
||||
},
|
||||
},
|
||||
|
@ -263,10 +259,8 @@ vote.callback = async function (msg, line, topic, {maybe}) {
|
|||
topic = topic.join(" ");
|
||||
|
||||
return {
|
||||
content: `**${msg.author.username}#${
|
||||
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" : ""
|
||||
content: `**${msg.author.username}#${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" : ""
|
||||
}`,
|
||||
addReactions: [
|
||||
":ms_tick:503341995348066313",
|
||||
|
@ -529,8 +523,7 @@ generate.callback = async function (msg, line) {
|
|||
const title = `Responses for "${safeString(line)}"`;
|
||||
|
||||
const out = {
|
||||
content: `Generated in ${formatTime(Date.now() - start)}${
|
||||
retries > 0 ? " with " + retries + " retries" : ""
|
||||
content: `Generated in ${formatTime(Date.now() - start)}${retries > 0 ? " with " + retries + " retries" : ""
|
||||
}`,
|
||||
embeds: [],
|
||||
files: images,
|
||||
|
@ -851,7 +844,7 @@ mcserver.callback = async function (msg, line) {
|
|||
url: "attachment://icon.png",
|
||||
},
|
||||
},
|
||||
file: {
|
||||
file: image && {
|
||||
file: image,
|
||||
name: "icon.png",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue