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:
ayeuhugyu 2023-09-30 08:17:43 -07:00
parent c97762e84c
commit b7492c8ad0
30 changed files with 262 additions and 684 deletions

View file

@ -5,8 +5,7 @@ import {
joinVoiceChannel,
} from "@discordjs/voice";
import fs from "fs";
import * as dotenv from "dotenv";
dotenv.config();
import * as action from "../util/discordAction.js";
const prefix = process.env.PREFIX;
@ -59,7 +58,8 @@ export default {
}
if (!file && !lsmode && !stopmode) {
message.reply(
action.reply(
message,
"unable to find your file in the soundboard folder put `ls` as your args to upload a file of all names. try replacing spaces with _s. you proposed: " +
proposedfilename
);
@ -78,9 +78,10 @@ export default {
adapterCreator: voiceState.guild.voiceAdapterCreator,
});
message.reply(`connected to <#${voiceState.channelId}>`);
action.reply(message, `connected to <#${voiceState.channelId}>`);
} else {
message.reply(
action.reply(
message,
"the bot is not in a voice channel so a sound cannot be played, and you are not in a voice channel so it can't auto join. IDIOT!"
);
return;
@ -90,7 +91,7 @@ export default {
connection.subscribe(audioPlayer);
audioPlayer.play(audioResource);
} else {
message.channel.send({
action.sendMessage(message.channelId, {
files: [
{
attachment: "resources/soundboard/ls.txt",