forgot to upload new files for 1.13 mb

This commit is contained in:
ayeuhugyu 2023-11-07 19:57:43 -08:00
parent 11a76b04ca
commit 95ba3fdf57
4 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,28 @@
import * as action from "../util/discordAction.js";
import fs from "fs";
const prefix = process.env.PREFIX;
const whitelist = ["440163494529073152"];
export default {
name: "addblacklist",
description: "adds a blacklist",
arguments: "none",
execute(message, args) {
if (whitelist.includes(message.author.id)) {
if (message.author.bot) return;
const msgnoprefix = message.content.slice(
prefix.length + this.name.length + 1
);
const user = msgnoprefix.slice(0, 2000);
if (user !== "") {
fs.appendFileSync("../pepperbot/data/blacklisted.log", user + "\n");
action.reply(
message,
`operation completed (🤖); added ${user} to blacklisted file`
);
}
}
},
};

View file

@ -0,0 +1,59 @@
import {
createAudioPlayer,
createAudioResource,
getVoiceConnection,
joinVoiceChannel,
} from "@discordjs/voice";
import fs from "fs";
import * as action from "../util/discordAction.js";
export default {
name: "randomsound",
description: "plays specified sound file",
arguments: "",
execute(message, args) {
const audioPlayer = createAudioPlayer();
const files = fs
.readdirSync("resources/soundboard")
.filter(
(file) =>
file.endsWith(".wav") ||
file.endsWith(".ogg") ||
file.endsWith(".webm") ||
file.endsWith(".mp3") ||
file.endsWith(".m4a")
);
const maxRan = files.length;
const randomnum = Math.floor(Math.random() * maxRan);
const audioResource = createAudioResource(
`resources/soundboard/${files[randomnum]}`
);
let connection = getVoiceConnection(message.guild.id);
if (!connection) {
if (message.member.voice.channel) {
let voiceState = message.member.voice;
let connection = joinVoiceChannel({
channelId: voiceState.channelId,
guildId: voiceState.guild.id,
adapterCreator: voiceState.guild.voiceAdapterCreator,
});
action.reply(message, `connected to <#${voiceState.channelId}>`);
} else {
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;
}
}
connection = getVoiceConnection(message.guild.id);
connection.subscribe(audioPlayer);
audioPlayer.play(audioResource);
action.reply(message, `playing \`${files[randomnum]}\``);
},
};

View file

@ -0,0 +1,42 @@
import * as action from "../util/discordAction.js";
import fs from "fs";
const whitelist = ["440163494529073152"];
const prefix = process.env.PREFIX;
export default {
name: "removeblacklist",
description: "removes a blacklist",
arguments: "none",
execute(message, args) {
if (whitelist.includes(message.author.id)) {
if (message.author.bot) return;
const msgnoprefix = message.content.slice(
prefix.length + this.name.length + 1
);
const filestring = fs.readFileSync(
"../pepperbot/data/blacklisted.log",
"utf8"
);
const blacklists = filestring.split("\n");
if (!blacklists.includes(msgnoprefix)) {
action.reply(message, "id is not blacklisted");
return;
}
const index = blacklists.indexOf(msgnoprefix);
if (index > -1) {
blacklists.splice(index, 1);
}
let text = "";
for (const file of blacklists) {
text += file + "\n";
}
fs.writeFileSync("../pepperbot/data/blacklisted.log", text);
action.reply(message, `removed \`${msgnoprefix}\` from blacklist file`);
} else {
action.reply(message, "not whitelisted");
}
},
};

View file

@ -0,0 +1,20 @@
import * as action from "../util/discordAction.js";
import fs from "fs";
export default {
name: "sendblacklist",
description: "sends blacklist",
arguments: "none",
execute(message, args) {
const filestring = fs.readFileSync(
"../pepperbot/data/blacklisted.log",
"utf8"
);
const blacklists = filestring.split("\n");
let text = "";
for (const file of blacklists) {
text += file + "\n";
}
action.sendMessage(message.channelId, text);
},
};