added p/recent and p/rejoin/other fixes
This commit is contained in:
parent
963136bf74
commit
89b75481e9
12 changed files with 156 additions and 16 deletions
|
@ -30,7 +30,8 @@ export default {
|
|||
filename.endsWith(".ogg") ||
|
||||
filename.endsWith(".webm") ||
|
||||
filename.endsWith(".m4a") ||
|
||||
filename.endsWith(".mp4")
|
||||
filename.endsWith(".mp4") ||
|
||||
filename.endsWith(".midi")
|
||||
) {
|
||||
const filenameNoExtension = filename.split(".")[0];
|
||||
const files = fs.readdirSync("resources/soundboard");
|
||||
|
|
26
src/commands/recent.js
Normal file
26
src/commands/recent.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import fs from "fs";
|
||||
import * as action from "../util/discordAction.js";
|
||||
|
||||
export default {
|
||||
name: "recent",
|
||||
description: "sends most recent deleted message",
|
||||
execute(message, args) {
|
||||
try {
|
||||
const recent = fs.readFileSync(
|
||||
`./logs/deletedmessages/${message.guild.id}.log`
|
||||
);
|
||||
} catch (err) {
|
||||
action.reply(
|
||||
message,
|
||||
"pepperbot has yet to log a deleted message in this server"
|
||||
);
|
||||
console.log(err);
|
||||
return;
|
||||
}
|
||||
const recent = fs.readFileSync(
|
||||
`../pepperbot/logs/deletedmessages/${message.guild.id}.log`,
|
||||
"utf8"
|
||||
);
|
||||
action.sendMessage(message.channelId, recent);
|
||||
},
|
||||
};
|
20
src/commands/rejoin.js
Normal file
20
src/commands/rejoin.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { getVoiceConnection } from "@discordjs/voice";
|
||||
import * as action from "../util/discordAction.js";
|
||||
|
||||
export default {
|
||||
name: "rejoin",
|
||||
description: "Rejoin the voice channel",
|
||||
execute(message, args) {
|
||||
const connection = getVoiceConnection(message.guild.id);
|
||||
if (connection) {
|
||||
try {
|
||||
connection.rejoin();
|
||||
action.reply(message, "remade voice connection");
|
||||
} catch (err) {
|
||||
action.sendError(err);
|
||||
}
|
||||
} else {
|
||||
action.reply(message, "no active voice connection in this guild");
|
||||
}
|
||||
},
|
||||
};
|
|
@ -36,6 +36,8 @@ export default {
|
|||
webm: proposedfilename + ".webm",
|
||||
spacedm4a: proposedfilename.replaceAll(" ", "_") + ".m4a",
|
||||
m4a: proposedfilename + ".m4a",
|
||||
spacedmp4: proposedfilename.replaceAll(" ", "_") + ".mp4",
|
||||
mp4: proposedfilename + ".mp4",
|
||||
};
|
||||
for (const value of Object.values(possibleFilenames)) {
|
||||
if (files.includes(value)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue