by popular request (i kept forgetting) the latest version of pepperbot has been published. inclides new blacklist feature (for my own amusement,) random sound, and tons of bug fixes
This commit is contained in:
parent
8c595a9a01
commit
11a76b04ca
6 changed files with 67 additions and 50 deletions
|
@ -17,6 +17,10 @@ clean up p/vileimagery, its horrendous
|
||||||
|
|
||||||
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
|
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
|
||||||
|
|
||||||
|
1.13 - new blacklist feature (for my own amusement,) random sound feature, tons of bug fixes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
1.12 - 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)
|
1.12 - 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)
|
||||||
1.12.1 - direct messages are now redirected to main channel
|
1.12.1 - direct messages are now redirected to main channel
|
||||||
1.12.2 - fixed being able to crash bot by creating messages over 2k characters
|
1.12.2 - fixed being able to crash bot by creating messages over 2k characters
|
||||||
|
|
|
@ -28,7 +28,8 @@ export default {
|
||||||
filename.endsWith(".mp3") ||
|
filename.endsWith(".mp3") ||
|
||||||
filename.endsWith(".wav") ||
|
filename.endsWith(".wav") ||
|
||||||
filename.endsWith(".ogg") ||
|
filename.endsWith(".ogg") ||
|
||||||
filename.endsWith(".webm")
|
filename.endsWith(".webm") ||
|
||||||
|
filename.endsWith(".m4a")
|
||||||
) {
|
) {
|
||||||
const filenameNoExtension = filename.split(".")[0];
|
const filenameNoExtension = filename.split(".")[0];
|
||||||
const files = fs.readdirSync("resources/soundboard");
|
const files = fs.readdirSync("resources/soundboard");
|
||||||
|
@ -95,7 +96,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
action.reply(
|
action.reply(
|
||||||
message,
|
message,
|
||||||
`invalid file extention; only \`mp3\`, \`wav\`, and \`ogg\` files are supported. \`${
|
`invalid file extention; only \`mp3\`, \`wav\`, \`ogg\`, \`webm\`, and \`m4a\` files are supported. \`${
|
||||||
filename.split(".")[1]
|
filename.split(".")[1]
|
||||||
}\` is not.`
|
}\` is not.`
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,7 @@ export default {
|
||||||
throw "crash command executed";
|
throw "crash command executed";
|
||||||
} else {
|
} else {
|
||||||
action.reply(message, "UNAUTHORIZED");
|
action.reply(message, "UNAUTHORIZED");
|
||||||
const path = require("path");
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,6 +34,8 @@ export default {
|
||||||
wav: proposedfilename + ".wav",
|
wav: proposedfilename + ".wav",
|
||||||
spacedwebm: proposedfilename.replaceAll(" ", "_") + ".webm",
|
spacedwebm: proposedfilename.replaceAll(" ", "_") + ".webm",
|
||||||
webm: proposedfilename + ".webm",
|
webm: proposedfilename + ".webm",
|
||||||
|
spacedm4a: proposedfilename.replaceAll(" ", "_") + ".m4a",
|
||||||
|
m4a: proposedfilename + ".m4a",
|
||||||
};
|
};
|
||||||
for (const value of Object.values(possibleFilenames)) {
|
for (const value of Object.values(possibleFilenames)) {
|
||||||
if (files.includes(value)) {
|
if (files.includes(value)) {
|
||||||
|
@ -63,6 +65,7 @@ export default {
|
||||||
"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: " +
|
"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
|
proposedfilename
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (!lsmode) {
|
if (!lsmode) {
|
||||||
const audioResource = createAudioResource(`resources/soundboard/${file}`);
|
const audioResource = createAudioResource(`resources/soundboard/${file}`);
|
||||||
|
@ -90,6 +93,7 @@ export default {
|
||||||
connection = getVoiceConnection(message.guild.id);
|
connection = getVoiceConnection(message.guild.id);
|
||||||
connection.subscribe(audioPlayer);
|
connection.subscribe(audioPlayer);
|
||||||
audioPlayer.play(audioResource);
|
audioPlayer.play(audioResource);
|
||||||
|
action.reply(message, `playing \`${file}\``);
|
||||||
} else {
|
} else {
|
||||||
action.sendMessage(message.channelId, {
|
action.sendMessage(message.channelId, {
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -30,13 +30,16 @@ function parseargs(string) {
|
||||||
const prefix = process.env.PREFIX;
|
const prefix = process.env.PREFIX;
|
||||||
|
|
||||||
export default function (message, client) {
|
export default function (message, client) {
|
||||||
|
const blacklistnosplit = fs.readFileSync("data/blacklisted.log", "utf8");
|
||||||
|
const blacklist = blacklistnosplit.split("\n");
|
||||||
|
|
||||||
if (message.channel.type === 1) {
|
if (message.channel.type === 1) {
|
||||||
log(
|
log(
|
||||||
"directmessages.log",
|
"directmessages.log",
|
||||||
message,
|
message,
|
||||||
import.meta.url,
|
import.meta.url,
|
||||||
`direct message from ${message.author.username} (${message.author}) with:
|
`direct message from ${message.author.username} (${message.author}) with:
|
||||||
"${message.content}"`
|
\`"${message.content}"\``
|
||||||
);
|
);
|
||||||
const channel = client.channels.cache.get("1148814162273763418");
|
const channel = client.channels.cache.get("1148814162273763418");
|
||||||
channel.send(
|
channel.send(
|
||||||
|
@ -44,6 +47,10 @@ export default function (message, client) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!message.content.startsWith(prefix)) return;
|
if (!message.content.startsWith(prefix)) return;
|
||||||
|
if (blacklist.includes(message.author.id)) {
|
||||||
|
message.reply("blacklisted smh");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const command = message.content
|
const command = message.content
|
||||||
.slice(prefix.length)
|
.slice(prefix.length)
|
||||||
|
@ -54,15 +61,8 @@ export default function (message, client) {
|
||||||
|
|
||||||
if (!commands.has(command)) {
|
if (!commands.has(command)) {
|
||||||
message.reply("idiot thats not a command");
|
message.reply("idiot thats not a command");
|
||||||
log(
|
return;
|
||||||
"failed.log",
|
|
||||||
message,
|
|
||||||
import.meta.url,
|
|
||||||
`attempt to use invalid command: ${command} by: ${message.author.username} (${message.author})"`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commands.get(command)) {
|
|
||||||
log(
|
log(
|
||||||
"commands.log",
|
"commands.log",
|
||||||
message,
|
message,
|
||||||
|
@ -74,4 +74,3 @@ export default function (message, client) {
|
||||||
commands.get(command).execute(message, args, client);
|
commands.get(command).execute(message, args, client);
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -4,17 +4,24 @@ import * as index from "../index.js";
|
||||||
const client = index.client;
|
const client = index.client;
|
||||||
|
|
||||||
export async function sendMainMessage(message) {
|
export async function sendMainMessage(message) {
|
||||||
|
try {
|
||||||
const channel = client.channels.cache.get("1148814162273763418");
|
const channel = client.channels.cache.get("1148814162273763418");
|
||||||
const msg = await channel.send(message.slice(0, 2000));
|
const msg = await channel.send(message);
|
||||||
return msg;
|
return msg;
|
||||||
|
} catch (err) {
|
||||||
|
sendError(toString(err).slice(err.length - 1750, err.length));
|
||||||
|
console.log(err);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendError(message) {
|
export function sendError(message) {
|
||||||
const channel = client.channels.cache.get("1148814162273763418");
|
const channel = client.channels.cache.get("1148814162273763418");
|
||||||
let msg;
|
let msg;
|
||||||
try {
|
try {
|
||||||
msg = channel.send(`**error:** ${message.slice(0, 1750)}`);
|
msg = channel.send(`**error:** ${message}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
sendError(err.rawError.message);
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +34,13 @@ export function messageDelete(message) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (message.deletable) {
|
if (message.deletable) {
|
||||||
|
try {
|
||||||
message.delete();
|
message.delete();
|
||||||
|
} catch (err) {
|
||||||
|
sendError(err.rawError.message);
|
||||||
|
console.log(err);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sendError(
|
sendError(
|
||||||
`unable to delete message: ${message.url}. most likely caused by invalid permissions`
|
`unable to delete message: ${message.url}. most likely caused by invalid permissions`
|
||||||
|
@ -39,33 +52,29 @@ export function messageDelete(message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendMessage(channelId, message) {
|
export async function sendMessage(channelId, message) {
|
||||||
(async () => {
|
|
||||||
const channel = client.channels.cache.get(channelId);
|
const channel = client.channels.cache.get(channelId);
|
||||||
let msg;
|
let msg;
|
||||||
if (channel) {
|
if (channel) {
|
||||||
try {
|
try {
|
||||||
msg = await channel.send(message.slice(0, 2000));
|
msg = await channel.send(message);
|
||||||
return msg;
|
return msg;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sendError(err.slice(err.length - 1750, err.length));
|
sendError(err.rawError.message);
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sendError(`unable to find channel: <#${channelId}>`);
|
sendError(`unable to find channel: <#${channelId}>`);
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reply(triggerMessage, message) {
|
export async function reply(triggerMessage, message) {
|
||||||
try {
|
try {
|
||||||
(async () => {
|
let msg = await triggerMessage.reply(message);
|
||||||
let msg = await triggerMessage.reply(message.slice(0, 2000));
|
|
||||||
return msg;
|
return msg;
|
||||||
})();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sendError(err.slice(err.length - 1750, err.length));
|
sendError(err.rawError.message);
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue