Compare commits

..

No commits in common. "921febf2785356eae436b123ef2d4c26b6800312" and "963136bf74cc024891a5171067e0bcb5b3c27000" have entirely different histories.

12 changed files with 18 additions and 159 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.env
src/logs
node_modules/
src/commands/cbrowser.js
src/commands/cbrowser.disabled

View file

@ -17,11 +17,6 @@ clean up p/vileimagery, its horrendous
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
1.15 - added p/recent and p/rejoin, p/recent sends the most recently deleted message, p/rejoin calls rejoin function on voice connections. also added some broken code for a voiceStateUpdate event but im too lazy to fix it so ill do that basically never. also deleted some useless line from .gitignore
1.15.1 - fixed exploit with recurring p/recents
---
1.14 - added announcement system, bug fixes
---

67
package-lock.json generated
View file

@ -14,7 +14,6 @@
"discord.js-collector": "^1.8.9",
"dotenv": "^16.3.1",
"emoji-regex": "^10.2.1",
"fs-extra": "^11.2.0",
"libsodium-wrappers": "^0.7.13",
"openai": "^4.17.0",
"regex": "^0.1.1",
@ -686,19 +685,6 @@
"node": ">= 14"
}
},
"node_modules/fs-extra": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=14.14"
}
},
"node_modules/getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@ -707,11 +693,6 @@
"assert-plus": "^1.0.0"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -835,17 +816,6 @@
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/JSONSelect": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
@ -1515,14 +1485,6 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
@ -2118,16 +2080,6 @@
}
}
},
"fs-extra": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@ -2136,11 +2088,6 @@
"assert-plus": "^1.0.0"
}
},
"graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -2241,15 +2188,6 @@
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"JSONSelect": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
@ -2761,11 +2699,6 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="
},
"uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",

View file

@ -16,7 +16,6 @@
"discord.js-collector": "^1.8.9",
"dotenv": "^16.3.1",
"emoji-regex": "^10.2.1",
"fs-extra": "^11.2.0",
"libsodium-wrappers": "^0.7.13",
"openai": "^4.17.0",
"regex": "^0.1.1",

View file

@ -30,8 +30,7 @@ export default {
filename.endsWith(".ogg") ||
filename.endsWith(".webm") ||
filename.endsWith(".m4a") ||
filename.endsWith(".mp4") ||
filename.endsWith(".midi")
filename.endsWith(".mp4")
) {
const filenameNoExtension = filename.split(".")[0];
const files = fs.readdirSync("resources/soundboard");

View file

@ -1,27 +0,0 @@
import fs from "fs";
import * as action from "../util/discordAction.js";
export default {
name: "recent",
description: "sends most recent deleted message",
execute(message, args) {
if (message.author.bot) return;
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);
},
};

View file

@ -1,20 +0,0 @@
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");
}
},
};

View file

@ -36,8 +36,6 @@ 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)) {

View file

@ -3,7 +3,6 @@ import { default as messageCreate } from "./messageCreate.js";
import { default as messageDelete } from "./messageDelete.js";
import { default as ready } from "./ready.js";
import { default as interactionCreate } from "./interactionCreate.js";
import { default as voiceStateUpdate } from "./voiceStateUpdate.js";
const events = {
guildMemberAdd,
@ -11,7 +10,6 @@ const events = {
messageDelete,
ready,
interactionCreate,
voiceStateUpdate,
};
export default events;

View file

@ -1,6 +1,4 @@
import { default as log } from "../util/log.js";
import fs from "fs";
import fsextra from "fs-extra";
export default function (message) {
try {
@ -8,17 +6,22 @@ export default function (message) {
"deletedmessages.log",
message,
import.meta.url,
`deleted message from: ${message.author.username} (${message.author}) with: "${message.content}"`,
`deleted message from ${message.author.username} (${message.author}) with: "${message.content}"`,
true
);
fsextra.ensureFileSync(
`../pepperbot/logs/deletedmessages/${message.guild.id}.log`
);
fs.writeFileSync(
`../pepperbot/logs/deletedmessages/${message.guild.id}.log`,
message.content
);
} catch {
function sendError(message) {
const channel = client.channels.cache.get("1148814162273763418");
let msg;
try {
msg = channel.send(`**error:** ${message}`);
} catch (err) {
sendError(err.rawError.message);
console.log(err);
return undefined;
}
return msg;
}
sendError("undefined error");
}
}

View file

@ -1,17 +0,0 @@
import { getVoiceConnection } from "@discordjs/voice";
export default async function (oldState, newState) {
if ((oldState.channelId = getVoiceConnection(oldState.guild.id))) {
if ((newState.channelId = undefined)) {
let channel = await client.channels.cache.get(oldState.channelId);
if (!channel) {
console.log("unable to find voice channel ");
return;
}
memberCount = channel.members.size;
if (MemberCount <= 1) {
channel.leave();
}
}
}
}

View file

@ -34,9 +34,6 @@ client.on("interactionCreate", (interaction) => {
events.interactionCreate(interaction);
});
client.on("voiceStateUpdate", (oldState, newState) => {
events.voiceStateUpdate(oldState, newState);
});
register();
client.login(process.env.TOKEN);