Compare commits
No commits in common. "25a386cf1ae475883f7dec985f5836a71d440e2a" and "9e566a2b33165014fb4ad1b215d8cba612a2fafb" have entirely different histories.
25a386cf1a
...
9e566a2b33
|
@ -2,5 +2,4 @@
|
|||
|
||||
Anonymous confessions for Discord, free as in freedom and price!
|
||||
|
||||
This is a fun little side-project I started after wanting to have my own Discord confessions bot, as an alternative to some that already exist. \
|
||||
**As a result, this bot currently does not scale well. I may make it do so in the future, but it is not currently a priority.**
|
||||
This is a fun little side-project I started after wanting to have my own Discord confessions bot, as an alternative to some that already exist.
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
ChatInputCommandInteraction,
|
||||
CommandInteraction,
|
||||
ComponentType,
|
||||
EmbedBuilder,
|
||||
SlashCommandBuilder,
|
||||
|
@ -50,7 +50,7 @@ export const data = new SlashCommandBuilder()
|
|||
.setDescription("The link to an image to attach (optional)")
|
||||
);
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
export async function execute(interaction: CommandInteraction) {
|
||||
// TODO: This all works as intended, but I'd like for it so be a reusable function
|
||||
// instead because all of this is reused in src/main.ts:56
|
||||
try {
|
||||
|
@ -73,11 +73,12 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
|||
.confessChannel;
|
||||
const adminChannel = dt.getGuildInfo(interaction.guild?.id!)?.settings
|
||||
.modChannel;
|
||||
// @ts-ignore
|
||||
const messageContent: string = `"${interaction.options.getString("message")}"`;
|
||||
// @ts-ignore
|
||||
const attachment: string = interaction.options.getString("attachment");
|
||||
|
||||
const messageContent = `"${interaction.options.getString("message")}"`;
|
||||
const attachment = interaction.options.getString("attachment")!;
|
||||
|
||||
const isAttachment = (text: string | null) =>
|
||||
const isAttachment = (text: string) =>
|
||||
text && (text.startsWith("http://") || text.startsWith("https://"));
|
||||
|
||||
const color = getRandomColor();
|
||||
|
@ -85,6 +86,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
|||
const userConfessionEmbed = new EmbedBuilder()
|
||||
.setColor(color)
|
||||
.setTitle(`Anonymous Confession \`${messageId}\``)
|
||||
// @ts-ignore
|
||||
.setDescription(messageContent);
|
||||
|
||||
isAttachment(attachment) && userConfessionEmbed.setImage(attachment);
|
||||
|
@ -92,6 +94,7 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
|||
const adminConfessionEmbed = new EmbedBuilder()
|
||||
.setColor(color)
|
||||
.setTitle(`Anonymous Confession \`${messageId}\``)
|
||||
// @ts-ignore
|
||||
.setDescription(messageContent)
|
||||
.addFields(
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
CommandInteraction,
|
||||
PermissionFlagsBits,
|
||||
SlashCommandBuilder
|
||||
} from "discord.js";
|
||||
|
@ -37,10 +37,11 @@ export const data = new SlashCommandBuilder()
|
|||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers);
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
export async function execute(interaction: CommandInteraction) {
|
||||
const result = dt.addBan(
|
||||
interaction.guild?.id!,
|
||||
interaction.options.getString("id")!
|
||||
// @ts-ignore
|
||||
interaction.options.getString("id")
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
CommandInteraction,
|
||||
EmbedBuilder,
|
||||
SlashCommandBuilder,
|
||||
|
@ -37,7 +36,7 @@ export const data = new SlashCommandBuilder()
|
|||
option.setName("id").setDescription("The confession id").setRequired(true)
|
||||
);
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
export async function execute(interaction: CommandInteraction) {
|
||||
if (!dt.getGuildInfo(interaction.guild?.id!)) {
|
||||
return interaction.reply({
|
||||
content:
|
||||
|
@ -46,7 +45,8 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
|||
});
|
||||
}
|
||||
|
||||
const idVal = interaction.options.getString("id")!;
|
||||
// @ts-ignore
|
||||
const idVal = interaction.options.getString("id");
|
||||
const result = dt.getConfession(interaction.guild?.id!, idVal);
|
||||
|
||||
if (result) {
|
||||
|
@ -71,6 +71,8 @@ export async function execute(interaction: ChatInputCommandInteraction) {
|
|||
});
|
||||
});
|
||||
|
||||
dt.delConfesssion(interaction, idVal);
|
||||
|
||||
return interaction.reply({
|
||||
content: "Confession removed.",
|
||||
ephemeral: true
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
ChatInputCommandInteraction,
|
||||
CommandInteraction,
|
||||
PermissionFlagsBits,
|
||||
SlashCommandBuilder
|
||||
} from "discord.js";
|
||||
|
@ -37,10 +37,11 @@ export const data = new SlashCommandBuilder()
|
|||
)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages);
|
||||
|
||||
export function execute(interaction: ChatInputCommandInteraction) {
|
||||
export function execute(interaction: CommandInteraction) {
|
||||
const result = dt.removeBan(
|
||||
interaction.guild?.id!,
|
||||
interaction.options.getString("id")!
|
||||
// @ts-ignore
|
||||
interaction.options.getString("id")
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,6 @@ import {
|
|||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonStyle,
|
||||
ChatInputCommandInteraction,
|
||||
ComponentType,
|
||||
EmbedBuilder,
|
||||
Events,
|
||||
|
@ -59,9 +58,7 @@ BotClient.on(Events.InteractionCreate, async interaction => {
|
|||
const { commandName } = interaction;
|
||||
|
||||
if (commands[commandName as keyof typeof commands]) {
|
||||
commands[commandName as keyof typeof commands].execute(
|
||||
interaction as ChatInputCommandInteraction
|
||||
);
|
||||
commands[commandName as keyof typeof commands].execute(interaction);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue