forked from cosmic/scythe
Compare commits
No commits in common. "95556c27d97eb58baf2459d8a666969954ef63c7" and "cfb7b31b361651b63357e5a57f47355cf6a30984" have entirely different histories.
95556c27d9
...
cfb7b31b36
|
|
@ -1,88 +0,0 @@
|
||||||
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,9 +33,6 @@ export class Intro {
|
||||||
set: { channel: channel.id },
|
set: { channel: channel.id },
|
||||||
setWhere: sql`guild = ${inter.guildId}`,
|
setWhere: sql`guild = ${inter.guildId}`,
|
||||||
});
|
});
|
||||||
await inter.reply({
|
await inter.reply({content: "intro setup done!", flags: MessageFlags.Ephemeral});
|
||||||
content: "intro setup done!",
|
|
||||||
flags: MessageFlags.Ephemeral,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ export class TicketComponenets {
|
||||||
.select()
|
.select()
|
||||||
.from(ticketsTable)
|
.from(ticketsTable)
|
||||||
.where(eq(ticketsTable.user, inter.user.id));
|
.where(eq(ticketsTable.user, inter.user.id));
|
||||||
|
|
||||||
if (check.length >= 1) {
|
if (check.length >= 1) {
|
||||||
await inter.reply({
|
await inter.reply({
|
||||||
content: "You already have a ticket open.",
|
content: "You already have a ticket open.",
|
||||||
|
|
@ -55,20 +54,12 @@ export class TicketComponenets {
|
||||||
PermissionsBitField.Flags.SendMessages,
|
PermissionsBitField.Flags.SendMessages,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: inter.client.user.id,
|
|
||||||
allow: [
|
|
||||||
PermissionsBitField.Flags.ViewChannel,
|
|
||||||
PermissionsBitField.Flags.SendMessages
|
|
||||||
],
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const category = inter.guild!.channels.cache.get(
|
const category = inter.guild?.channels.cache.get(
|
||||||
Bun.env.TICKET_CATEGORY,
|
Bun.env.TICKET_CATEGORY,
|
||||||
) as CategoryChannel;
|
) as CategoryChannel;
|
||||||
|
|
||||||
channel = await channel.setParent(category);
|
channel = await channel.setParent(category);
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
CREATE TABLE `confess` (
|
|
||||||
`guild` text PRIMARY KEY NOT NULL,
|
|
||||||
`channel` text NOT NULL
|
|
||||||
);
|
|
||||||
|
|
@ -1,214 +0,0 @@
|
||||||
{
|
|
||||||
"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,13 +29,6 @@
|
||||||
"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,9 +36,4 @@ 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,16 +28,11 @@ export class MemberEvents {
|
||||||
await member.roles.add(botRole);
|
await member.roles.add(botRole);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (
|
if(Date.now() - member.user.createdAt.getTime() < 1000 * 60 * 60 * 24 * 7) {
|
||||||
Date.now() - member.user.createdAt.getTime() <
|
|
||||||
1000 * 60 * 60 * 24 * 7
|
|
||||||
) {
|
|
||||||
try {
|
try {
|
||||||
await member.send(
|
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.")
|
||||||
"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(_) {}
|
||||||
);
|
await member.kick("account less than week old")
|
||||||
} catch (_) {}
|
|
||||||
await member.kick("account less than week old");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await db.insert(colonTable).values({
|
await db.insert(colonTable).values({
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ 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 {
|
||||||
|
|
@ -19,6 +20,6 @@ export class Ready {
|
||||||
}
|
}
|
||||||
bumpRemind(client);
|
bumpRemind(client);
|
||||||
uptimeLoop(client);
|
uptimeLoop(client);
|
||||||
//introCheck(client);
|
introCheck(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ 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