Development (#47)

pull/67/head
Skyler 3 years ago committed by GitHub
commit 3535e78302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -127,7 +127,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
);
}
for (const option of options) {
optionString += `> ${option.name} (${ApplicationCommandOptionType[option.type]})- ${
optionString += `> \`${option.name}\` (${ApplicationCommandOptionType[option.type]}) - ${
option.description
}\n`;
}

@ -79,7 +79,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
if (!("awaitMessageComponent" in channel)) return;
try {
i1 = await channel!.awaitMessageComponent<ComponentType.Button>({
filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id,
filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id && i.message.id === m.id,
time: 300000
});
} catch (e) {
@ -120,7 +120,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
let i;
try {
i = await m.awaitMessageComponent<ComponentType.Button>({
filter: (i) => i.user.id === interaction.user.id,
filter: (i) => i.user.id === interaction.user.id && i.message.id === m.id,
time: 300000
});
} catch {

@ -67,7 +67,11 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
};
do {
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder().setCustomId("edit").setLabel("Edit Embed").setStyle(ButtonStyle.Secondary),
new ButtonBuilder()
.setCustomId("edit")
.setLabel("Edit Embed")
.setStyle(ButtonStyle.Secondary)
.setEmoji(getEmojiByName("ICONS.EDIT") as APIMessageComponentEmoji),
new ButtonBuilder()
.setCustomId("send")
.setLabel("Send")
@ -143,7 +147,8 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction | Discord.StringSelectMenuInteraction;
try {
i = (await interaction.channel!.awaitMessageComponent({
filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
filter: (i: Discord.Interaction) =>
i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as
| Discord.ButtonInteraction
@ -223,17 +228,18 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
case "send": {
await i.deferUpdate();
const channel = interaction.guild!.channels.cache.get(data.channel!) as Discord.TextChannel;
const components = new ActionRowBuilder<ButtonBuilder>();
const messageData: MessageCreateOptions = {};
for (const button of data.buttons) {
components.addComponents(
new ButtonBuilder()
.setCustomId(button)
.setLabel(buttonNames[button]!)
.setStyle(ButtonStyle.Primary)
);
messageData.components = [
new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
.setCustomId(button)
.setLabel(buttonNames[button]!)
.setStyle(ButtonStyle.Primary)
)
];
}
const messageData: MessageCreateOptions = { components: [components] };
if (data.title || data.description) {
if (data.title || data.description || data.color) {
const e = new EmojiEmbed();
if (data.title) e.setTitle(data.title);
if (data.description) e.setDescription(data.description);

@ -20,7 +20,7 @@ export const command = new SlashCommandSubcommandBuilder()
.setDescription("Automatically publish messages posted in announcement channels");
export const callback = async (interaction: CommandInteraction): Promise<void> => {
await interaction.reply({
const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@ -70,7 +70,8 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
try {
i = (await interaction.channel!.awaitMessageComponent({
filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
filter: (i: Discord.Interaction) =>
i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
} catch (e) {

@ -18,7 +18,7 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
if (interaction.guild) client.database.premium.hasPremium(interaction.guild.id).finally(() => {});
await interaction.reply({
const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@ -79,7 +79,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let i: Discord.ButtonInteraction | Discord.SelectMenuInteraction;
try {
i = (await interaction.channel!.awaitMessageComponent({
i = (await m.awaitMessageComponent({
filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
time: 300000
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;

@ -122,7 +122,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
let i: ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
try {
i = (await m.awaitMessageComponent({
filter: (i) => i.user.id === interaction.user.id,
filter: (i) => i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
} catch (e) {

@ -19,7 +19,7 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
if (!interaction.guild) return;
await interaction.reply({
const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@ -67,7 +67,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
try {
i = await interaction.channel!.awaitMessageComponent<ComponentType.Button | ComponentType.ChannelSelect>({
filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
filter: (i: Discord.Interaction) =>
i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
});
} catch (e) {

@ -1,7 +1,7 @@
import fs from "fs";
import * as readLine from "node:readline/promises";
const defaultDict: Record<string, string | string[] | boolean | Record<string, string>> = {
const defaultDict: Record<string, string | string[] | boolean | Record<string, string | number>> = {
developmentToken: "Your development bot token (Used for testing in one server, rather than production)",
developmentGuildID: "Your development guild ID",
enableDevelopment: true,
@ -29,7 +29,12 @@ const defaultDict: Record<string, string | string[] | boolean | Record<string, s
pastebinApiKey: "An API key for pastebin (optional)",
pastebinUsername: "Your pastebin username (optional)",
pastebinPassword: "Your pastebin password (optional)",
rapidApiKey: "Your RapidAPI key (optional), used for Unscan"
rapidApiKey: "Your RapidAPI key (optional), used for Unscan",
clamav: {
socket: "Your ClamAV socket file (optional)",
host: "Your ClamAV host (optional)",
port: "Your ClamAV port (optional)"
}
};
const readline = readLine.createInterface({

@ -19,7 +19,11 @@ declare const config: {
};
baseUrl: string;
rapidApiKey: string;
clamavSocket: string;
clamav: {
socket?: string;
host?: string;
port?: number;
};
};
export default config;

@ -26,7 +26,9 @@ interface MalwareSchema {
const nsfw_model = await nsfwjs.load("file://dist/reflex/nsfwjs/example/nsfw_demo/public/model/", { size: 299 });
const clamscanner = await new ClamScan().init({
clamdscan: {
socket: config.clamavSocket
socket: "socket" in config.clamav ? (config.clamav.socket as string) : false,
host: "host" in config.clamav ? (config.clamav.host as string) : false,
port: "port" in config.clamav ? (config.clamav.port as number) : false
}
});

Loading…
Cancel
Save