changed most discord actions to be handled by 1 script. this should cut down on errors and allow you to actually use the bot in other servers (i think)
This commit is contained in:
parent
c97762e84c
commit
b7492c8ad0
30 changed files with 262 additions and 684 deletions
|
@ -1,4 +1,5 @@
|
|||
import fs from "fs";
|
||||
import * as action from "../util/discordAction.js";
|
||||
import request from "request"; // yes i know this is deprecated i will fix it later (no i won't)
|
||||
|
||||
function download(url, filename) {
|
||||
|
@ -57,7 +58,8 @@ export default {
|
|||
filename
|
||||
);
|
||||
if (success) {
|
||||
message.reply(
|
||||
action.reply(
|
||||
message,
|
||||
`downloaded your file to \`resources/soundboard/${filename
|
||||
.toLowerCase()
|
||||
.replaceAll(" ", "_")
|
||||
|
@ -67,30 +69,39 @@ export default {
|
|||
)}\`, if this name is different than the one you put, that's normal. all files are lowercased and "fixed."`
|
||||
);
|
||||
} else {
|
||||
message.reply(
|
||||
action.reply(
|
||||
message,
|
||||
"an unknown error occurred while attempting to download your file. see the console for details (id put it here but its probably too long for discord)"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
message.reply(
|
||||
`invalid file name! the file name either already exists, or you named it ls. don't name it ls.`
|
||||
action.reply(
|
||||
message,
|
||||
`invalid file name! the file name either already exists, or you named it ls. don't name it ls. detected file name: \`${filename}\``
|
||||
);
|
||||
}
|
||||
} else {
|
||||
message.reply(
|
||||
`invalid file name! the file name either already exists, or you named it ls. don't name it ls.`
|
||||
action.reply(
|
||||
message,
|
||||
`invalid file name! the file name either already exists, or you named it ls. don't name it ls. detected file name: \`${filename}\``
|
||||
);
|
||||
}
|
||||
} else {
|
||||
message.reply("error has occurred; filename could not be split");
|
||||
action.reply(
|
||||
message,
|
||||
"error has occurred; filename could not be split"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
message.reply(
|
||||
"invalid file extention; only `mp3`, `wav`, and `ogg` files are supported"
|
||||
action.reply(
|
||||
message,
|
||||
`invalid file extention; only \`mp3\`, \`wav\`, and \`ogg\` files are supported. \`${
|
||||
filename.split(".")[1]
|
||||
}\` is not.`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
message.reply("no file detected");
|
||||
action.reply(message, "no file detected");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue