v 1.14 added announcements system, minor bug fixes

This commit is contained in:
ayeuhugyu 2023-11-07 20:50:44 -08:00
parent 25e4065fef
commit 9e960c9288
3 changed files with 56 additions and 7 deletions

View file

@ -0,0 +1,29 @@
const whitelist = ["440163494529073152"];
import * as action from "../util/discordAction.js";
import { default as log } from "../util/log.js";
const prefix = process.env.PREFIX;
export default {
name: "pepperannouncement",
description: "PEPPER ANNOUNCEMENT SYSTEM",
arguments: "title, text",
execute(message, args) {
if (whitelist.includes(message.author.id)) {
const title = args[0];
const msgnoprefix = message.content.slice(
prefix.length + this.name.length + title.length + 2
);
const msg = msgnoprefix.slice(0, 2000);
const embed = action.createEmbed();
embed.setTitle(title);
embed.setDescription(msg);
action.sendMessage("1171660137946157146", { embeds: [embed] });
action.messageDelete(message);
} else {
action.reply(message, "UNAUTHORIZED");
return;
}
},
};

View file

@ -1,11 +1,27 @@
import { default as log } from "../util/log.js";
export default function (message) {
log(
"deletedmessages.log",
message,
import.meta.url,
`deleted message from ${message.author.username} (${message.author}) with: "${message.content}"`,
true
);
try {
log(
"deletedmessages.log",
message,
import.meta.url,
`deleted message from ${message.author.username} (${message.author}) with: "${message.content}"`,
true
);
} 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");
}
}