confess stuffs
This commit is contained in:
parent
cfb7b31b36
commit
b77ac1bbaa
|
|
@ -0,0 +1,88 @@
|
||||||
|
import {
|
||||||
|
ApplicationCommandOptionType,
|
||||||
|
Attachment,
|
||||||
|
Colors,
|
||||||
|
CommandInteraction,
|
||||||
|
EmbedBuilder,
|
||||||
|
MessageFlags,
|
||||||
|
TextChannel,
|
||||||
|
} from "discord.js";
|
||||||
|
import { Discord, Slash, SlashOption } from "discordx";
|
||||||
|
import db from "../db";
|
||||||
|
import { confessTable } from "../db/schema";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
|
|
||||||
|
@Discord()
|
||||||
|
export class Confession {
|
||||||
|
@Slash({ name: "confess-setup", description: "setup confessions" })
|
||||||
|
async confessSetup(
|
||||||
|
@SlashOption({
|
||||||
|
name: "log_channel",
|
||||||
|
description: "channel to send logs",
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.Channel,
|
||||||
|
})
|
||||||
|
channel: TextChannel,
|
||||||
|
inter: CommandInteraction,
|
||||||
|
) {
|
||||||
|
if (inter.guild?.ownerId != inter.user.id) {
|
||||||
|
return inter.reply("you aren't the owner silly!");
|
||||||
|
}
|
||||||
|
await db.insert(confessTable).values({
|
||||||
|
guild: inter.guildId!,
|
||||||
|
channel: channel.id,
|
||||||
|
});
|
||||||
|
await inter.reply("confess setup done!");
|
||||||
|
}
|
||||||
|
@Slash({
|
||||||
|
name: "confess",
|
||||||
|
description: "confessions are LOGGED for moderation purposes.",
|
||||||
|
})
|
||||||
|
async confess(
|
||||||
|
@SlashOption({
|
||||||
|
name: "message",
|
||||||
|
description: "message to confess",
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
})
|
||||||
|
message: string,
|
||||||
|
@SlashOption({
|
||||||
|
name: "attachment",
|
||||||
|
description: "submit an image attachment with the message :3",
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Attachment,
|
||||||
|
})
|
||||||
|
attachment: Attachment,
|
||||||
|
inter: CommandInteraction,
|
||||||
|
) {
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle("A Confession!")
|
||||||
|
.setDescription(message)
|
||||||
|
.setFooter({ text: "Confessions" })
|
||||||
|
.setColor(Colors.DarkRed);
|
||||||
|
|
||||||
|
const logEmbed = new EmbedBuilder()
|
||||||
|
.setTitle(`Confession Log from ${inter.user.username}`)
|
||||||
|
.setDescription(message)
|
||||||
|
.setFooter({ text: "Confession Log" });
|
||||||
|
|
||||||
|
if (attachment) {
|
||||||
|
embed.setImage(attachment.url);
|
||||||
|
logEmbed.setImage(attachment.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
const channelRes = await db
|
||||||
|
.select()
|
||||||
|
.from(confessTable)
|
||||||
|
.where(eq(confessTable.guild, inter.guildId!));
|
||||||
|
const channel = inter.client.channels.cache.get(
|
||||||
|
channelRes[0].channel,
|
||||||
|
) as TextChannel;
|
||||||
|
await (inter.channel as TextChannel).send({ embeds: [embed] });
|
||||||
|
await inter.reply({
|
||||||
|
content: "Confession Sent",
|
||||||
|
flags: MessageFlags.Ephemeral,
|
||||||
|
});
|
||||||
|
await channel.send({ embeds: [logEmbed] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,9 @@ export class Intro {
|
||||||
set: { channel: channel.id },
|
set: { channel: channel.id },
|
||||||
setWhere: sql`guild = ${inter.guildId}`,
|
setWhere: sql`guild = ${inter.guildId}`,
|
||||||
});
|
});
|
||||||
await inter.reply({content: "intro setup done!", flags: MessageFlags.Ephemeral});
|
await inter.reply({
|
||||||
|
content: "intro setup done!",
|
||||||
|
flags: MessageFlags.Ephemeral,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE `confess` (
|
||||||
|
`guild` text PRIMARY KEY NOT NULL,
|
||||||
|
`channel` text NOT NULL
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,214 @@
|
||||||
|
{
|
||||||
|
"version": "6",
|
||||||
|
"dialect": "sqlite",
|
||||||
|
"id": "dea3a962-3fb8-4c45-90fa-baff2f53bfb2",
|
||||||
|
"prevId": "fb3b9c6d-7d3b-4651-b230-e163bf08b586",
|
||||||
|
"tables": {
|
||||||
|
"bye": {
|
||||||
|
"name": "bye",
|
||||||
|
"columns": {
|
||||||
|
"guild": {
|
||||||
|
"name": "guild",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"name": "message",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"colonthree": {
|
||||||
|
"name": "colonthree",
|
||||||
|
"columns": {
|
||||||
|
"user": {
|
||||||
|
"name": "user",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"amount": {
|
||||||
|
"name": "amount",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"messages_count": {
|
||||||
|
"name": "messages_count",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"confess": {
|
||||||
|
"name": "confess",
|
||||||
|
"columns": {
|
||||||
|
"guild": {
|
||||||
|
"name": "guild",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"greets": {
|
||||||
|
"name": "greets",
|
||||||
|
"columns": {
|
||||||
|
"guild": {
|
||||||
|
"name": "guild",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"name": "message",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"intro": {
|
||||||
|
"name": "intro",
|
||||||
|
"columns": {
|
||||||
|
"guild": {
|
||||||
|
"name": "guild",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"tickets": {
|
||||||
|
"name": "tickets",
|
||||||
|
"columns": {
|
||||||
|
"user": {
|
||||||
|
"name": "user",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
},
|
||||||
|
"uptime": {
|
||||||
|
"name": "uptime",
|
||||||
|
"columns": {
|
||||||
|
"guild": {
|
||||||
|
"name": "guild",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": true,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"name": "channel",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"name": "message",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true,
|
||||||
|
"autoincrement": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexes": {},
|
||||||
|
"foreignKeys": {},
|
||||||
|
"compositePrimaryKeys": {},
|
||||||
|
"uniqueConstraints": {},
|
||||||
|
"checkConstraints": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"views": {},
|
||||||
|
"enums": {},
|
||||||
|
"_meta": {
|
||||||
|
"schemas": {},
|
||||||
|
"tables": {},
|
||||||
|
"columns": {}
|
||||||
|
},
|
||||||
|
"internal": {
|
||||||
|
"indexes": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,6 +29,13 @@
|
||||||
"when": 1742927150677,
|
"when": 1742927150677,
|
||||||
"tag": "0003_clumsy_mephistopheles",
|
"tag": "0003_clumsy_mephistopheles",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 4,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1744606507294,
|
||||||
|
"tag": "0004_keen_bedlam",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,9 @@ export const introTable = sqliteTable("intro", {
|
||||||
channel: text().notNull(),
|
channel: text().notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const confessTable = sqliteTable("confess", {
|
||||||
|
guild: text().primaryKey(),
|
||||||
|
channel: text().notNull(),
|
||||||
|
});
|
||||||
|
|
||||||
export type ColonThreeType = InferSelectModel<typeof colonTable>;
|
export type ColonThreeType = InferSelectModel<typeof colonTable>;
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,16 @@ export class MemberEvents {
|
||||||
await member.roles.add(botRole);
|
await member.roles.add(botRole);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(Date.now() - member.user.createdAt.getTime() < 1000 * 60 * 60 * 24 * 7) {
|
if (
|
||||||
|
Date.now() - member.user.createdAt.getTime() <
|
||||||
|
1000 * 60 * 60 * 24 * 7
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
await member.send("to protect against raids, bots, and other disturbances, accounts under a week old are kicked upon joining. please wait for your account to mature before rejoining.")
|
await member.send(
|
||||||
|
"to protect against raids, bots, and other disturbances, accounts under a week old are kicked upon joining. please wait for your account to mature before rejoining.",
|
||||||
|
);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
await member.kick("account less than week old")
|
await member.kick("account less than week old");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await db.insert(colonTable).values({
|
await db.insert(colonTable).values({
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { Client, Discord, On, type ArgsOf } from "discordx";
|
||||||
import { underageCheck } from "../utils/underage";
|
import { underageCheck } from "../utils/underage";
|
||||||
import { bumpRemind } from "../utils/bump";
|
import { bumpRemind } from "../utils/bump";
|
||||||
import { uptimeLoop } from "../utils/uptime-loop";
|
import { uptimeLoop } from "../utils/uptime-loop";
|
||||||
import { introCheck } from "../utils/intro-check";
|
|
||||||
|
|
||||||
@Discord()
|
@Discord()
|
||||||
export class Ready {
|
export class Ready {
|
||||||
|
|
@ -20,6 +19,6 @@ export class Ready {
|
||||||
}
|
}
|
||||||
bumpRemind(client);
|
bumpRemind(client);
|
||||||
uptimeLoop(client);
|
uptimeLoop(client);
|
||||||
introCheck(client);
|
//introCheck(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export const introCheck = async (client: Client) => {
|
||||||
for (const c of channelRes) {
|
for (const c of channelRes) {
|
||||||
const channel = client.channels.cache.get(c.channel) as TextChannel;
|
const channel = client.channels.cache.get(c.channel) as TextChannel;
|
||||||
const guild = client.guilds.cache.get(c.guild);
|
const guild = client.guilds.cache.get(c.guild);
|
||||||
|
await guild?.fetch();
|
||||||
const msgs = await channel.messages.fetch({ limit: 10 });
|
const msgs = await channel.messages.fetch({ limit: 10 });
|
||||||
for (const m of msgs) {
|
for (const m of msgs) {
|
||||||
if (!guild?.members.cache.has(m[1].author.id)) {
|
if (!guild?.members.cache.has(m[1].author.id)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue