├── .gitignore ├── src ├── events │ ├── Client │ │ └── ready.ts │ └── Guild │ │ ├── automod-messageUpdate.ts │ │ ├── autocomplete.ts │ │ ├── chatInputCommand.ts │ │ ├── afk.ts │ │ └── automod.ts ├── example.config.ts ├── index.ts ├── commands │ ├── Utility │ │ ├── membercount.ts │ │ ├── oldestmember.ts │ │ ├── timestamp.ts │ │ ├── ping.ts │ │ ├── afk.ts │ │ ├── serverinfo.ts │ │ ├── infractions.ts │ │ ├── automod infractions.ts │ │ ├── userinfo.ts │ │ └── help.ts │ ├── Moderation │ │ ├── yeet.ts │ │ ├── remove infraction.ts │ │ ├── clear infractions.ts │ │ ├── unban.ts │ │ ├── unmute.ts │ │ ├── update warn reason.ts │ │ ├── echo.ts │ │ ├── warn.ts │ │ ├── kick.ts │ │ ├── ban.ts │ │ ├── mute.ts │ │ ├── slowmode.ts │ │ ├── channel lock unlock.ts │ │ ├── server lockdown unlock.ts │ │ ├── purge.ts │ │ └── note.ts │ └── Administrator │ │ └── custom-command.ts ├── class │ ├── Builders.ts │ └── ExtendedClient.ts └── func │ └── index.ts ├── global.d.ts ├── .env.example ├── tsconfig.json ├── command.example.txt ├── package.json ├── prisma └── schema.prisma ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | 4 | package-lock.json 5 | .env 6 | src/config.ts 7 | prisma/migrations 8 | prisma/dev.db 9 | prisma/dev.db-journal -------------------------------------------------------------------------------- /src/events/Client/ready.ts: -------------------------------------------------------------------------------- 1 | import { client } from "../.."; 2 | import { Event } from "../../class/Builders"; 3 | 4 | export default new Event('ready', async () => { 5 | console.log('Loggged in as: ' + client.user?.tag); 6 | }); -------------------------------------------------------------------------------- /src/example.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | lockdown: { 3 | channels: [] 4 | }, 5 | moderation: { 6 | protectedRoles: [] 7 | }, 8 | automod: { 9 | protectedRoles: [] 10 | } 11 | }; -------------------------------------------------------------------------------- /global.d.ts: -------------------------------------------------------------------------------- 1 | // This file is used for .env typings. 2 | declare namespace NodeJS { 3 | export interface ProcessEnv { 4 | DATABASE_URL: string; 5 | CLIENT_TOKEN: string; 6 | CLIENT_ID: string; 7 | OWNER_ID: string; 8 | } 9 | } -------------------------------------------------------------------------------- /src/events/Guild/automod-messageUpdate.ts: -------------------------------------------------------------------------------- 1 | import { Message } from "discord.js"; 2 | import { Event } from "../../class/Builders"; 3 | import { _mainAutomodFunction } from "./automod"; 4 | 5 | export default new Event('messageUpdate', (_old, message: Message) => _mainAutomodFunction(message)); -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Edit this incase if you want to change the database type 2 | DATABASE_URL="file:./dev.db" # The database URL ("file:./dev.db" for SQLite) 3 | 4 | # Client configuration 5 | CLIENT_TOKEN="" # Your bot token 6 | CLIENT_ID="" # Your bot ID 7 | 8 | OWNER_ID="" # Your account ID 9 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { config } from 'dotenv'; 2 | import ExtendedClient from './class/ExtendedClient'; 3 | 4 | config(); 5 | 6 | export const client = new ExtendedClient(); 7 | 8 | client.start(); 9 | 10 | process.on('uncaughtException', console.error); 11 | process.on('unhandledRejection', console.error); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "CommonJS", 5 | "outDir": "dist", 6 | "esModuleInterop": true 7 | }, 8 | "include": [ 9 | "src/", 10 | "global.d.ts" 11 | ], 12 | "exclude": [ 13 | "dist", 14 | "node_module" 15 | ] 16 | } -------------------------------------------------------------------------------- /command.example.txt: -------------------------------------------------------------------------------- 1 | import { SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | 4 | export default new Command( 5 | new SlashCommandBuilder() 6 | .setName('') 7 | .setDescription('') 8 | .setDMPermission(false), 9 | async (client, interaction, db) => { 10 | 11 | } 12 | ); 13 | -------------------------------------------------------------------------------- /src/events/Guild/autocomplete.ts: -------------------------------------------------------------------------------- 1 | import { client } from "../.."; 2 | import { Event } from "../../class/Builders"; 3 | 4 | export default new Event('interactionCreate', async (interaction) => { 5 | if (!interaction.isAutocomplete()) return; 6 | 7 | const command = client.commands.get(interaction.commandName); 8 | 9 | if (!command) return; 10 | 11 | try { 12 | if (command.options?.autocomplete) command.options.autocomplete(client, interaction); 13 | } catch (e) { 14 | console.error(e); 15 | }; 16 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tfa-utils-open-source", 3 | "version": "1.0.0", 4 | "description": "T.F.A's Utilities is a powerful and advanced Discord moderation bot built for T.F.A 7524 - Development.", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "build": "tsc && node ." 8 | }, 9 | "keywords": [], 10 | "author": "TFAGaming", 11 | "license": "GPL-3.0", 12 | "dependencies": { 13 | "@prisma/client": "^4.16.2", 14 | "aqify.js": "^2.4.3", 15 | "axios": "^1.4.0", 16 | "discord.js": "^14.12.1", 17 | "dotenv": "^16.3.1", 18 | "ms": "^2.1.3" 19 | }, 20 | "devDependencies": { 21 | "@types/ms": "^0.7.31", 22 | "prisma": "^4.16.2", 23 | "typescript": "^2.0.4" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/commands/Utility/membercount.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | 4 | export default new Command( 5 | new SlashCommandBuilder() 6 | .setName('membercount') 7 | .setDescription('Get the number of humans and bots on the server.') 8 | .setDMPermission(false), 9 | async (client, interaction, db) => { 10 | 11 | await interaction.reply({ 12 | embeds: [ 13 | new EmbedBuilder() 14 | .setTitle('Server Member Count') 15 | .setDescription(`There are currently **${interaction.guild.memberCount}** members in total.\n**Humans**: ${interaction.guild.members.cache.filter((m) => m.user.bot === false).size}\n**Bots**: ${interaction.guild.members.cache.filter((m) => m.user.bot === true).size}`) 16 | .setColor('Blurple') 17 | ] 18 | }); 19 | 20 | } 21 | ); 22 | -------------------------------------------------------------------------------- /src/commands/Utility/oldestmember.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | 4 | export default new Command( 5 | new SlashCommandBuilder() 6 | .setName('oldestmember') 7 | .setDescription('Find the first person that joined the server!') 8 | .setDMPermission(false), 9 | async (client, interaction, db) => { 10 | 11 | const member = [...interaction.guild.members.cache 12 | .filter((v) => v.user.id !== interaction.guild.ownerId) 13 | .sort((a, b) => a.joinedTimestamp - b.joinedTimestamp) 14 | .values()][0]; 15 | 16 | await interaction.reply({ 17 | embeds: [ 18 | new EmbedBuilder() 19 | .setTitle('Oldest Member') 20 | .setDescription(`The user ` + member.user.toString() + ' is the first person to join this server!') 21 | .setColor('Blurple') 22 | ] 23 | }); 24 | } 25 | ); 26 | -------------------------------------------------------------------------------- /src/events/Guild/chatInputCommand.ts: -------------------------------------------------------------------------------- 1 | import { client } from "../.."; 2 | import { Event } from "../../class/Builders"; 3 | import { checkCC, embed } from "../../func"; 4 | 5 | export default new Event('interactionCreate', async (interaction) => { 6 | if (!interaction.isChatInputCommand()) return; 7 | 8 | const command = client.commands.get(interaction.commandName); 9 | 10 | if (!command) { 11 | await checkCC(interaction); 12 | 13 | return; 14 | }; 15 | 16 | const { options } = command; 17 | 18 | if (options) { 19 | // Owner only 20 | if (options.ownerOnly && interaction.user.id !== process.env.OWNER_ID) { 21 | await interaction.reply({ 22 | embeds: [ 23 | embed('You are not the developer of the bot.', 'error') 24 | ], 25 | ephemeral: true 26 | }); 27 | 28 | return; 29 | }; 30 | }; 31 | 32 | try { 33 | command.run(client, interaction, client.db); 34 | } catch (e) { 35 | console.error(e); 36 | }; 37 | }); -------------------------------------------------------------------------------- /prisma/schema.prisma: -------------------------------------------------------------------------------- 1 | // This is your Prisma schema file, 2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema 3 | 4 | generator client { 5 | provider = "prisma-client-js" 6 | } 7 | 8 | datasource db { 9 | provider = "sqlite" 10 | url = env("DATABASE_URL") 11 | } 12 | 13 | model Afk { 14 | id Int @id @default(autoincrement()) 15 | userId String 16 | guildId String 17 | afk Boolean @default(false) 18 | reason String @default("No reason was provided") 19 | } 20 | 21 | model Infraction { 22 | id String @id 23 | guildId String 24 | userId String 25 | moderatorId String 26 | reason String? @default("No reason was provided") 27 | type String @default("Warn") 28 | since BigInt 29 | expires BigInt? 30 | } 31 | 32 | model AutomodInfraction { 33 | id String @id 34 | guildId String 35 | userId String 36 | reason String? @default("No reason was provided") 37 | since BigInt 38 | expires BigInt? 39 | } 40 | 41 | model Note { 42 | id Int @id @default(autoincrement()) 43 | guildId String 44 | userId String 45 | authorId String 46 | message String 47 | since BigInt 48 | edited Boolean? @default(false) 49 | } 50 | 51 | model CustomCommand { 52 | id Int @id @default(autoincrement()) 53 | guildId String 54 | name String 55 | description String 56 | content String 57 | } 58 | -------------------------------------------------------------------------------- /src/commands/Moderation/yeet.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { wait } from "aqify.js"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('yeet') 8 | .setDescription('Yeet all server members!!1!1!1!!!11!') 9 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 10 | .setDMPermission(false), 11 | async (client, interaction, db) => { 12 | 13 | await interaction.reply({ 14 | content: `Please wait...` 15 | }); 16 | 17 | await wait(3000); 18 | 19 | const edit = async (percent: number) => { 20 | await wait(1750); 21 | 22 | await interaction.editReply({ 23 | content: `Yeeting \`${interaction.guild.memberCount}\` members... (${percent}%)` 24 | }); 25 | }; 26 | 27 | await edit(1); 28 | await edit(9); 29 | await edit(14); 30 | await edit(26); 31 | await edit(35); 32 | await edit(49); 33 | await edit(51); 34 | await edit(62); 35 | await edit(69); 36 | await edit(78); 37 | await edit(84); 38 | await edit(91); 39 | await edit(99); 40 | 41 | await wait(1000); 42 | 43 | await interaction.followUp({ 44 | content: 'Oh no! I don\'t have the required permissions, request cancelled.' 45 | }); 46 | } 47 | ); 48 | -------------------------------------------------------------------------------- /src/commands/Utility/timestamp.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | 4 | export default new Command( 5 | new SlashCommandBuilder() 6 | .setName('timestamp') 7 | .setDescription('Get or make a timestamp for Discord.') 8 | .addIntegerOption((opt) => 9 | opt.setName('unix') 10 | .setDescription('The unix time if you want to test.') 11 | .setRequired(false) 12 | ) 13 | .setDMPermission(false), 14 | async (client, interaction, db) => { 15 | const unix = interaction.options.getInteger('unix') || Date.now(); 16 | 17 | await interaction.reply({ 18 | embeds: [ 19 | new EmbedBuilder() 20 | .setTitle('Timestamp') 21 | .setDescription(`Unix time: ${unix}\nThe timestamp type is optional. By default, it's \`f\`.`) 22 | .addFields( 23 | { name: 'Date', value: `\`\` \n\`\` ` }, 24 | { name: 'Time', value: `\`\` \n\`\` ` }, 25 | { name: 'Date & Time', value: `\`\` \n\`\` ` }, 26 | { name: 'Relative', value: `\`\` ` } 27 | ) 28 | .setColor('Blurple') 29 | ] 30 | }) 31 | } 32 | ); 33 | -------------------------------------------------------------------------------- /src/events/Guild/afk.ts: -------------------------------------------------------------------------------- 1 | import { wait } from "aqify.js"; 2 | import { client } from "../.."; 3 | import { Event } from "../../class/Builders"; 4 | 5 | export default new Event('messageCreate', async (message) => { 6 | if (message.author.bot) return; 7 | if (!message.guild) return; 8 | 9 | const data = await client.db.afk.findFirst({ 10 | where: { 11 | guildId: message.guildId, 12 | userId: message.author.id 13 | } 14 | }); 15 | 16 | if (data) { 17 | await client.db.afk.deleteMany({ 18 | where: { 19 | guildId: message.guildId, 20 | userId: message.author.id 21 | } 22 | }); 23 | 24 | await message.reply({ 25 | content: `**Welcome back**! I have removed your AFK status.` 26 | }).then(async (sent) => { 27 | await wait(5000); 28 | 29 | await sent.delete().catch(() => { }); 30 | }).catch(() => { }); 31 | } else { 32 | const member = message.mentions.members.first(); 33 | if (!member) return; 34 | 35 | const memberData = await client.db.afk.findFirst({ 36 | where: { 37 | guildId: message.guildId, 38 | userId: member.user.id 39 | } 40 | }); 41 | 42 | if (!memberData) return; 43 | 44 | await message.reply({ 45 | content: `${member.toString()} is currently **AFK**. | ${memberData.reason}`, 46 | allowedMentions: { 47 | parse: [] 48 | } 49 | }).catch(() => { }); 50 | }; 51 | 52 | }); -------------------------------------------------------------------------------- /src/class/Builders.ts: -------------------------------------------------------------------------------- 1 | import { AutocompleteInteraction, ChatInputCommandInteraction, ClientEvents, SlashCommandBuilder, SlashCommandSubcommandsOnlyBuilder } from "discord.js"; 2 | import ExtendedClient from "./ExtendedClient"; 3 | 4 | export interface CommandOptions { 5 | ownerOnly?: boolean, 6 | autocomplete?: (client: ExtendedClient, interaction: AutocompleteInteraction) => void 7 | }; 8 | 9 | export class Command { 10 | readonly structure: SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | Omit; 11 | readonly run: (client: ExtendedClient, interaction: ChatInputCommandInteraction, db: ExtendedClient['db']) => void; 12 | readonly options: CommandOptions | undefined; 13 | 14 | constructor( 15 | structure: SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | Omit, 16 | run: (client: ExtendedClient, interaction: ChatInputCommandInteraction, db: ExtendedClient['db']) => void, 17 | options?: CommandOptions, 18 | ) { 19 | this.structure = structure; 20 | this.run = run; 21 | this.options = options; 22 | }; 23 | }; 24 | 25 | export class Event { 26 | readonly event: K; 27 | readonly run: (...args: ClientEvents[K]) => void; 28 | readonly once?: boolean; 29 | 30 | constructor( 31 | event: K, 32 | run: (...args: ClientEvents[K]) => void, 33 | once?: boolean 34 | ) { 35 | this.event = event; 36 | this.run = run; 37 | this.once = once; 38 | }; 39 | }; -------------------------------------------------------------------------------- /src/commands/Moderation/remove infraction.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('remove') 8 | .setDescription('Remove an infraction from a user.') 9 | .addSubcommand((s) => 10 | s.setName('infraction') 11 | .setDescription('Remove an infraction from a user.') 12 | .addStringOption((o) => 13 | o.setName('id') 14 | .setDescription('The ID of the infraction.') 15 | .setRequired(true) 16 | ) 17 | ) 18 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 19 | .setDMPermission(false), 20 | async (client, interaction, db) => { 21 | const id = interaction.options.getString('id', true); 22 | 23 | await interaction.deferReply({ ephemeral: true }); 24 | 25 | const count = await db.infraction.count({ 26 | where: { 27 | id: id 28 | } 29 | }); 30 | 31 | if (count === 0) { 32 | await interaction.followUp({ 33 | embeds: [ 34 | embed('Invalid ID provided.', 'error') 35 | ] 36 | }); 37 | 38 | return; 39 | }; 40 | 41 | await db.infraction.delete({ 42 | where: { 43 | id: id 44 | } 45 | }); 46 | 47 | await interaction.followUp({ 48 | embeds: [ 49 | embed('The ID \`' + id + '\` has been successfully removed.', 'info') 50 | ] 51 | }); 52 | } 53 | ); -------------------------------------------------------------------------------- /src/commands/Utility/ping.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | 4 | export default new Command( 5 | new SlashCommandBuilder() 6 | .setName('ping') 7 | .setDescription('Replies with Pong!') 8 | .setDMPermission(false), 9 | async (client, interaction) => { 10 | const dateBeforeDefer = Date.now(); 11 | 12 | await interaction.deferReply(); 13 | 14 | const dateAfterDefer = Date.now(); 15 | 16 | const dateBeforeDB = Date.now(); 17 | 18 | await client.db.infraction.findMany(); 19 | 20 | const dateAfterDB = Date.now(); 21 | 22 | await interaction.followUp({ 23 | embeds: [ 24 | new EmbedBuilder() 25 | .setTitle('Latency') 26 | .addFields( 27 | { 28 | name: 'Client', 29 | value: `**WS ping**: ${client.ws.ping}ms\n**Heartbeat**: 80beat/s`, 30 | inline: true 31 | }, 32 | { 33 | name: 'Interaction', 34 | value: `**Type**: ChatInputCommandInteraction\n**Latency**: ${dateAfterDefer - dateBeforeDefer}ms`, 35 | inline: true 36 | }, 37 | { 38 | name: 'Database', 39 | value: `**Provider**: SQLite\n**Manager**: Prisma.io\n**Latency**: ${dateAfterDB - dateBeforeDB}ms`, 40 | inline: true 41 | } 42 | ) 43 | .setColor('Blurple') 44 | ] 45 | }); 46 | } 47 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/clear infractions.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('clear') 8 | .setDescription('Clear all user infractions.') 9 | .addSubcommand((s) => 10 | s.setName('infractions') 11 | .setDescription('Clear all user infractions.') 12 | .addUserOption((o) => 13 | o.setName('user') 14 | .setDescription('The user to clear it\'s infractions.') 15 | .setRequired(true) 16 | ) 17 | ) 18 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 19 | .setDMPermission(false), 20 | async (client, interaction, db) => { 21 | const user = interaction.options.getUser('user', true); 22 | 23 | await interaction.deferReply({ ephemeral: true }); 24 | 25 | const count = await db.infraction.count({ 26 | where: { 27 | guildId: interaction.guildId, 28 | userId: user.id 29 | } 30 | }); 31 | 32 | if (count === 0) { 33 | await interaction.followUp({ 34 | embeds: [ 35 | embed('No infractions were found for that user.') 36 | ] 37 | }); 38 | 39 | return; 40 | }; 41 | 42 | await db.infraction.deleteMany({ 43 | where: { 44 | guildId: interaction.guildId, 45 | userId: user.id 46 | } 47 | }); 48 | 49 | await interaction.followUp({ 50 | embeds: [ 51 | embed('Successfully cleared all infractions from ' + user.toString() + '.', 'info') 52 | ] 53 | }); 54 | } 55 | ); -------------------------------------------------------------------------------- /src/commands/Utility/afk.ts: -------------------------------------------------------------------------------- 1 | import { SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('afk') 8 | .setDescription('Set yourself AFK on the server.') 9 | .addStringOption((o) => 10 | o.setName('reason') 11 | .setDescription('The reason of the AFK.') 12 | .setRequired(false) 13 | ) 14 | .setDMPermission(false), 15 | async (client, interaction, db) => { 16 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 17 | 18 | await interaction.deferReply({ ephemeral: true }); 19 | 20 | const data = await db.afk.findFirst({ 21 | where: { 22 | guildId: interaction.guildId, 23 | userId: interaction.user.id 24 | } 25 | }); 26 | 27 | if (data?.afk) { 28 | await interaction.followUp({ 29 | embeds: [ 30 | embed('You are AFK already, send a message to remove this AFK status.') 31 | ] 32 | }); 33 | 34 | return; 35 | }; 36 | 37 | await db.afk.create({ 38 | data: { 39 | guildId: interaction.guildId, 40 | userId: interaction.user.id, 41 | afk: true, 42 | reason: reason 43 | } 44 | }); 45 | 46 | await interaction.followUp({ 47 | embeds: [ 48 | embed('You are now marked as AFK!', 'info') 49 | ] 50 | }); 51 | 52 | await interaction.channel?.send({ 53 | content: `${interaction.user.toString()} is now **AFK**. | ${reason}`, 54 | allowedMentions: { 55 | parse: [] 56 | } 57 | }); 58 | } 59 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/unban.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('unban') 8 | .setDescription('Unban a user.') 9 | .addUserOption((o) => 10 | o.setName('user') 11 | .setDescription('The user to unban.') 12 | .setRequired(true) 13 | ) 14 | .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) 15 | .setDMPermission(false), 16 | async (client, interaction, db) => { 17 | const user = interaction.options.getUser('user', true); 18 | 19 | await interaction.deferReply({ ephemeral: true }); 20 | 21 | try { 22 | const bans = await interaction.guild.bans.fetch(); 23 | 24 | if (!bans.has(user.id)) { 25 | await interaction.followUp({ 26 | embeds: [ 27 | embed('That user is already unbanned, or never been banned before.', 'error') 28 | ] 29 | }); 30 | 31 | return; 32 | }; 33 | 34 | await interaction.guild.members.unban(user); 35 | 36 | await interaction.followUp({ 37 | embeds: [ 38 | embed('Successfully unbanned ' + user.toString() + '!', 'info') 39 | ] 40 | }); 41 | 42 | await interaction.channel.send({ 43 | embeds: [ 44 | embed(`${user.toString()} has been **unbanned** with the ID: \`${interaction.id}\``, 'info') 45 | ] 46 | }); 47 | 48 | } catch (e) { 49 | console.error(e); 50 | 51 | await interaction.editReply({ 52 | embeds: [ 53 | embed('Unable to run the command properly, please check the console.', 'error') 54 | ] 55 | }); 56 | }; 57 | } 58 | ); -------------------------------------------------------------------------------- /src/commands/Utility/serverinfo.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import { time } from "aqify.js"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('serverinfo') 9 | .setDescription('Get this server\'s information.') 10 | .setDMPermission(false), 11 | async (client, interaction, db) => { 12 | const guild = interaction.guild; 13 | 14 | let boostlvl = 0; 15 | 16 | if (guild.premiumSubscriptionCount >= 2) boostlvl = 1; 17 | if (guild.premiumSubscriptionCount >= 7) boostlvl = 2; 18 | if (guild.premiumSubscriptionCount >= 14) boostlvl = 3; 19 | 20 | const verificationLevelText = { 21 | 0: "None", 22 | 1: "Low", 23 | 2: "Medium", 24 | 3: "(╯°□°)╯︵ ┻━┻", 25 | 4: "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻" 26 | }; 27 | 28 | await interaction.reply({ 29 | embeds: [ 30 | new EmbedBuilder() 31 | .setTitle('Server Info') 32 | .setThumbnail(guild.iconURL()) 33 | .addFields( 34 | { inline: true, name: 'Server', value: `**Name**: ${guild.name}\n**ID**: ${guild.id}\n**Release date**: ${time(guild.createdTimestamp, 'D')} (${time(guild.createdTimestamp, 'R')})\n**Channels**: ${guild.channels.cache.size}\n**Emojis**: ${guild.emojis.cache.size}\n**Boosts**: ${guild.premiumSubscriptionCount}\n**Boost Level**: ${boostlvl}\n**Application commands registered**: ${guild.commands.cache.size}\n**Verification level**: ${verificationLevelText[guild.verificationLevel]}` }, 35 | { inline: true, name: 'Members', value: `**Total**: ${guild.members.cache.size}\n**Owner**: <@${guild.ownerId}>\n**Humans**: ${interaction.guild.members.cache.filter((v) => v.user.bot === false).size}\n**Bots**: ${interaction.guild.members.cache.filter((v) => v.user.bot === true).size}` } 36 | ) 37 | .setColor('Blurple') 38 | ] 39 | }); 40 | } 41 | ); 42 | -------------------------------------------------------------------------------- /src/commands/Moderation/unmute.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('unmute') 8 | .setDescription('Unmute a user.') 9 | .addUserOption((o) => 10 | o.setName('user') 11 | .setDescription('The user to unmute.') 12 | .setRequired(true) 13 | ) 14 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 15 | .setDMPermission(false), 16 | async (client, interaction, db) => { 17 | const member = interaction.guild.members.cache.get(interaction.options.getUser('user', true).id); 18 | 19 | await interaction.deferReply({ ephemeral: true }); 20 | 21 | try { 22 | if (member.isCommunicationDisabled() === false) { 23 | await interaction.followUp({ 24 | embeds: [ 25 | embed('The user is already unmuted.') 26 | ] 27 | }); 28 | 29 | return; 30 | }; 31 | 32 | await member.timeout(0); 33 | 34 | await member.user?.send({ 35 | content: `You have been **unmuted** from **${interaction.guild.name}**, you can start to chat again.` 36 | }).catch(() => { }); 37 | 38 | await interaction.followUp({ 39 | embeds: [ 40 | embed('Successfully unmuted ' + member.user.toString() + '!', 'info') 41 | ] 42 | }); 43 | 44 | await interaction.channel.send({ 45 | embeds: [ 46 | embed(`${member.user.toString()} has been **unmuted** with the ID: \`${interaction.id}\``, 'info') 47 | ] 48 | }); 49 | 50 | } catch (e) { 51 | console.error(e); 52 | 53 | await interaction.editReply({ 54 | embeds: [ 55 | embed('Unable to run the command properly, please check the console.', 'error') 56 | ] 57 | }); 58 | }; 59 | } 60 | ); -------------------------------------------------------------------------------- /src/commands/Utility/infractions.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, EmbedField, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import { time } from "aqify.js"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('infractions') 9 | .setDescription('Read all the infractions history of you or another person.') 10 | .addUserOption((o) => 11 | o.setName('user') 12 | .setDescription('The user to check their infractions.') 13 | .setRequired(false) 14 | ) 15 | .setDMPermission(false), 16 | async (client, interaction, db) => { 17 | interaction.user = interaction.options.getUser('user') || interaction.user; 18 | 19 | await interaction.deferReply(); 20 | 21 | const count = await db.infraction.count({ 22 | where: { 23 | guildId: interaction.guildId, 24 | userId: interaction.user.id 25 | } 26 | }); 27 | 28 | if (count === 0) { 29 | await interaction.followUp({ 30 | embeds: [ 31 | embed(interaction.user.toString() + ' is currently have no infractions.', 'info') 32 | ] 33 | }); 34 | 35 | return; 36 | }; 37 | 38 | const data = await db.infraction.findMany({ 39 | where: { 40 | guildId: interaction.guildId, 41 | userId: interaction.user.id 42 | } 43 | }); 44 | 45 | const fields: EmbedField[] = []; 46 | 47 | for (const infraction of data) { 48 | fields.push({ 49 | name: `**ID**: \`${infraction.id}\` | **Expires**: ${infraction.expires ? time(parseInt(infraction.expires.toString()), 'R') : 'Permanent'}`, 50 | value: `**${infraction.type}**: ${infraction.reason} — ${time(parseInt(infraction.since.toString()), 'd')}`, 51 | inline: false 52 | }); 53 | }; 54 | 55 | await interaction.followUp({ 56 | embeds: [ 57 | new EmbedBuilder() 58 | .setAuthor({ 59 | name: interaction.user.username, 60 | iconURL: interaction.user.displayAvatarURL() 61 | }) 62 | .addFields(fields) 63 | ] 64 | }); 65 | } 66 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/update warn reason.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('update') 8 | .setDescription('Update a warn reason.') 9 | .addSubcommandGroup((s) => 10 | s.setName('warn') 11 | .setDescription('Update a warn reason.') 12 | .addSubcommand((s) => 13 | s.setName('reason') 14 | .setDescription('Update a warn reason.') 15 | .addStringOption((o) => 16 | o.setName('id') 17 | .setDescription('The ID of the warn.') 18 | .setRequired(true) 19 | ) 20 | .addStringOption((o) => 21 | o.setName('new-reason') 22 | .setDescription('The new reason of the warning.') 23 | .setRequired(true) 24 | ) 25 | ) 26 | ) 27 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 28 | .setDMPermission(false), 29 | async (client, interaction, db) => { 30 | const id = interaction.options.getString('id', true); 31 | const reason = interaction.options.getString('new-reason', true); 32 | 33 | await interaction.deferReply({ ephemeral: true }); 34 | 35 | const count = await db.infraction.count({ 36 | where: { 37 | id: id, 38 | type: 'Warn' 39 | } 40 | }); 41 | 42 | if (count === 0) { 43 | await interaction.followUp({ 44 | embeds: [ 45 | embed('Invalid ID provided, or the type of infraction is not **Warn**.', 'error') 46 | ] 47 | }); 48 | 49 | return; 50 | }; 51 | 52 | await db.infraction.update({ 53 | where: { 54 | id: id 55 | }, 56 | data: { 57 | reason: reason 58 | } 59 | }) 60 | 61 | await interaction.followUp({ 62 | embeds: [ 63 | embed('The warning reason from the ID \`' + id + '\` has been updated.', 'info') 64 | ] 65 | }); 66 | } 67 | ); -------------------------------------------------------------------------------- /src/commands/Utility/automod infractions.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, EmbedField, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import { time } from "aqify.js"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('automod') 9 | .setDescription('Read all the infractions by automod history of your account.') 10 | .addSubcommand((s) => 11 | s.setName('infractions') 12 | .setDescription('Read all the infractions by automod history of your account.') 13 | .addUserOption((o) => 14 | o.setName('user') 15 | .setDescription('The user to check their infractions.') 16 | .setRequired(false) 17 | ) 18 | ) 19 | .setDMPermission(false), 20 | async (client, interaction, db) => { 21 | interaction.user = interaction.options.getUser('user') || interaction.user; 22 | 23 | await interaction.deferReply(); 24 | 25 | const count = await db.automodInfraction.count({ 26 | where: { 27 | guildId: interaction.guildId, 28 | userId: interaction.user.id 29 | } 30 | }); 31 | 32 | if (count === 0) { 33 | await interaction.followUp({ 34 | embeds: [ 35 | embed(interaction.user.toString() + ' is currently have no infractions.', 'info') 36 | ] 37 | }); 38 | 39 | return; 40 | }; 41 | 42 | const data = await db.automodInfraction.findMany({ 43 | where: { 44 | guildId: interaction.guildId, 45 | userId: interaction.user.id 46 | } 47 | }); 48 | 49 | const fields: EmbedField[] = []; 50 | 51 | for (const infraction of data) { 52 | fields.push({ 53 | name: `**ID**: \`${infraction.id}\` | **Expires**: ${infraction.expires ? time(parseInt(infraction.expires.toString()), 'R') : 'Permanent'}`, 54 | value: `**Verbal warn**: ${infraction.reason} — ${time(parseInt(infraction.since.toString()), 'd')}`, 55 | inline: false 56 | }); 57 | }; 58 | 59 | await interaction.followUp({ 60 | embeds: [ 61 | new EmbedBuilder() 62 | .setAuthor({ 63 | name: interaction.user.username, 64 | iconURL: interaction.user.displayAvatarURL() 65 | }) 66 | .setDescription('These are the warnings that were issued by ' + client.user.toString() + ', not manually.') 67 | .addFields(fields) 68 | ] 69 | }); 70 | } 71 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/echo.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('echo') 8 | .setDescription('Send a message to a user in DMs.') 9 | .addUserOption((opt) => 10 | opt.setName('user') 11 | .setDescription('The user to DM them.') 12 | .setRequired(true) 13 | ) 14 | .addStringOption((opt) => 15 | opt.setName('message') 16 | .setDescription('The message for the DM.') 17 | .setRequired(false) 18 | ) 19 | .addAttachmentOption((opt) => 20 | opt.setName('attachment') 21 | .setDescription('If you want to send them a media (picture/video).') 22 | .setRequired(false) 23 | ) 24 | .addBooleanOption((opt) => 25 | opt.setName('mention') 26 | .setDescription('Tell the user that you are the author of the message or not.') 27 | .setRequired(false) 28 | ) 29 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 30 | .setDMPermission(false), 31 | async (client, interaction) => { 32 | 33 | const user = interaction.options.getUser('user', true); 34 | const message = interaction.options.getString('message'); 35 | const attachment = interaction.options.getAttachment('attachment'); 36 | const mention = interaction.options.getBoolean('mention') || false; 37 | 38 | await interaction.deferReply({ ephemeral: true }); 39 | 40 | try { 41 | if (!message && !attachment) { 42 | await interaction.followUp({ 43 | embeds: [ 44 | embed('You need at least to send a message, either an attachment.', 'error') 45 | ] 46 | }); 47 | 48 | return; 49 | }; 50 | 51 | await user?.send({ 52 | content: `${mention ? `**${interaction.user.tag}** has sent you a message:\n` : ''}${message}`, 53 | files: attachment ? [attachment] : undefined 54 | }).catch(() => { }); 55 | 56 | await interaction.editReply({ 57 | embeds: [ 58 | embed('Successfully sent the message to ' + user.toString() + '.', 'info') 59 | ] 60 | }); 61 | 62 | } catch (e) { 63 | console.error(e); 64 | 65 | await interaction.editReply({ 66 | embeds: [ 67 | embed('Unable to run the command properly, please check the console.', 'error') 68 | ] 69 | }); 70 | }; 71 | 72 | } 73 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/warn.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import ms from 'ms'; 4 | import { embed, protectedRolesChecker } from "../../func"; 5 | import config from "../../config"; 6 | 7 | export default new Command( 8 | new SlashCommandBuilder() 9 | .setName('warn') 10 | .setDescription('Warn a user.') 11 | .addUserOption((o) => 12 | o.setName('user') 13 | .setDescription('The user to warn.') 14 | .setRequired(true) 15 | ) 16 | .addStringOption((o) => 17 | o.setName('reason') 18 | .setDescription('The reason of the warn.') 19 | .setRequired(false) 20 | ) 21 | .addBooleanOption((o) => 22 | o.setName('permanent') 23 | .setDescription('Whenever the warning should never be expired or not.') 24 | .setRequired(false) 25 | ) 26 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 27 | .setDMPermission(false), 28 | async (client, interaction, db) => { 29 | const user = interaction.options.getUser('user', true); 30 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 31 | const duration = interaction.options.getBoolean('permanent') ? null : (BigInt(Date.now() + ms('7d'))); 32 | 33 | await interaction.deferReply({ ephemeral: true }); 34 | 35 | if (protectedRolesChecker(interaction.guild.members.cache.get(user.id), config.moderation.protectedRoles)) { 36 | await interaction.followUp({ 37 | embeds: [ 38 | embed('That user cannot be punished.', 'error') 39 | ] 40 | }); 41 | 42 | return; 43 | }; 44 | 45 | await user?.send({ 46 | content: `You have been **warned** in **${interaction.guild.name}**.\nYour punishment reason: ${reason}` 47 | }).catch(() => { }); 48 | 49 | await db.infraction.create({ 50 | data: { 51 | id: interaction.id, 52 | guildId: interaction.guildId, 53 | userId: user.id, 54 | moderatorId: interaction.user.id, 55 | expires: duration, 56 | since: BigInt(Date.now()), 57 | type: 'Warn', 58 | reason: reason 59 | } 60 | }); 61 | 62 | await interaction.followUp({ 63 | embeds: [ 64 | embed('Successfully warned ' + user.toString() + '!', 'info') 65 | ] 66 | }); 67 | 68 | await interaction.channel.send({ 69 | embeds: [ 70 | embed(`${user.toString()} has been **warned** with the ID: \`${interaction.id}\``, 'warn') 71 | ] 72 | }); 73 | } 74 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/kick.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed, protectedRolesChecker } from "../../func"; 4 | import config from "../../config"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('kick') 9 | .setDescription('Kick a user.') 10 | .addUserOption((o) => 11 | o.setName('user') 12 | .setDescription('The user to kick.') 13 | .setRequired(true) 14 | ) 15 | .addStringOption((o) => 16 | o.setName('reason') 17 | .setDescription('The reason of the kick.') 18 | .setRequired(false) 19 | ) 20 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 21 | .setDMPermission(false), 22 | async (client, interaction, db) => { 23 | const user = interaction.options.getUser('user', true); 24 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 25 | 26 | await interaction.deferReply({ ephemeral: true }); 27 | 28 | try { 29 | if (protectedRolesChecker(interaction.guild.members.cache.get(user.id), config.moderation.protectedRoles)) { 30 | await interaction.followUp({ 31 | embeds: [ 32 | embed('That user cannot be punished.', 'error') 33 | ] 34 | }); 35 | 36 | return; 37 | }; 38 | 39 | await user?.send({ 40 | content: `You have been **kicked** from **${interaction.guild.name}**.\nYour punishment reason: ${reason}` 41 | }).catch(() => { }); 42 | 43 | await interaction.guild.members.kick(user, reason); 44 | 45 | await db.infraction.create({ 46 | data: { 47 | id: interaction.id, 48 | guildId: interaction.guildId, 49 | userId: user.id, 50 | moderatorId: interaction.user.id, 51 | since: BigInt(Date.now()), 52 | expires: null, 53 | type: 'Kick', 54 | reason: reason 55 | } 56 | }); 57 | 58 | await interaction.followUp({ 59 | embeds: [ 60 | embed('Successfully kicked ' + user.toString() + '!', 'info') 61 | ] 62 | }); 63 | 64 | await interaction.channel.send({ 65 | embeds: [ 66 | embed(`${user.toString()} has been **kicked** with the ID: \`${interaction.id}\``, 'warn') 67 | ] 68 | }); 69 | } catch (e) { 70 | console.error(e); 71 | 72 | await interaction.editReply({ 73 | embeds: [ 74 | embed('Unable to run the command properly, please check the console.', 'error') 75 | ] 76 | }); 77 | }; 78 | } 79 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/ban.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed, protectedRolesChecker } from "../../func"; 4 | import config from "../../config"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('ban') 9 | .setDescription('Ban a user.') 10 | .addUserOption((o) => 11 | o.setName('user') 12 | .setDescription('The user to ban.') 13 | .setRequired(true) 14 | ) 15 | .addStringOption((o) => 16 | o.setName('reason') 17 | .setDescription('The reason of the ban.') 18 | .setRequired(false) 19 | ) 20 | .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) 21 | .setDMPermission(false), 22 | async (client, interaction, db) => { 23 | const user = interaction.options.getUser('user', true); 24 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 25 | 26 | await interaction.deferReply({ ephemeral: true }); 27 | 28 | try { 29 | if (protectedRolesChecker(interaction.guild.members.cache.get(user.id), config.moderation.protectedRoles)) { 30 | await interaction.followUp({ 31 | embeds: [ 32 | embed('That user cannot be punished.', 'error') 33 | ] 34 | }); 35 | 36 | return; 37 | }; 38 | 39 | const bans = await interaction.guild.bans.fetch(); 40 | 41 | if (bans.has(user.id)) { 42 | await interaction.followUp({ 43 | embeds: [ 44 | embed('That user is already banned.', 'error') 45 | ] 46 | }); 47 | 48 | return; 49 | }; 50 | 51 | await user?.send({ 52 | content: `You have been **banned** from **${interaction.guild.name}**.\nYour punishment reason: ${reason}` 53 | }).catch(() => { }); 54 | 55 | await interaction.guild.members.ban(user, { reason: reason }); 56 | 57 | await db.infraction.create({ 58 | data: { 59 | id: interaction.id, 60 | guildId: interaction.guildId, 61 | userId: user.id, 62 | moderatorId: interaction.user.id, 63 | since: BigInt(Date.now()), 64 | type: 'Ban', 65 | expires: null, 66 | reason: reason 67 | } 68 | }); 69 | 70 | await interaction.followUp({ 71 | embeds: [ 72 | embed('Successfully banned ' + user.toString() + '!', 'info') 73 | ] 74 | }); 75 | 76 | await interaction.channel.send({ 77 | embeds: [ 78 | embed(`${user.toString()} has been **banned** with the ID: \`${interaction.id}\``, 'error') 79 | ] 80 | }); 81 | } catch (e) { 82 | console.error(e); 83 | 84 | await interaction.editReply({ 85 | embeds: [ 86 | embed('Unable to run the command properly, please check the console.', 'error') 87 | ] 88 | }); 89 | }; 90 | } 91 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/mute.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import ms from "ms"; 4 | import { embed, protectedRolesChecker } from "../../func"; 5 | import config from "../../config"; 6 | 7 | export default new Command( 8 | new SlashCommandBuilder() 9 | .setName('mute') 10 | .setDescription('Mute a user.') 11 | .addUserOption((o) => 12 | o.setName('user') 13 | .setDescription('The user to mute.') 14 | .setRequired(true) 15 | ) 16 | .addStringOption((o) => 17 | o.setName('reason') 18 | .setDescription('The reason of the mute.') 19 | .setRequired(false) 20 | ) 21 | .addStringOption((o) => 22 | o.setName('duration') 23 | .setDescription('The duration of the mute. By default, 6 hours.') 24 | .setRequired(false) 25 | ) 26 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 27 | .setDMPermission(false), 28 | async (client, interaction, db) => { 29 | const member = interaction.guild.members.cache.get(interaction.options.getUser('user', true).id); 30 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 31 | const duration = interaction.options.getString('duration') ? ms(interaction.options.getString('duration', true)) : ms('6h'); 32 | 33 | await interaction.deferReply({ ephemeral: true }); 34 | 35 | try { 36 | if (protectedRolesChecker(member, config.moderation.protectedRoles)) { 37 | await interaction.followUp({ 38 | embeds: [ 39 | embed('That user cannot be punished.', 'error') 40 | ] 41 | }); 42 | 43 | return; 44 | }; 45 | 46 | if (member.isCommunicationDisabled().valueOf()) { 47 | await interaction.followUp({ 48 | embeds: [ 49 | embed('The user is already muted.') 50 | ] 51 | }); 52 | 53 | return; 54 | }; 55 | 56 | await member.user?.send({ 57 | content: `You have been **muted** in **${interaction.guild.name}**.\nYour punishment reason: ${reason}` 58 | }).catch(() => { }); 59 | 60 | await member.timeout(duration, reason).catch(() => { }); 61 | 62 | await db.infraction.create({ 63 | data: { 64 | id: interaction.id, 65 | guildId: interaction.guildId, 66 | userId: member.user.id, 67 | moderatorId: interaction.user.id, 68 | expires: null, 69 | since: BigInt(Date.now()), 70 | type: 'Mute', 71 | reason: reason 72 | } 73 | }); 74 | 75 | await interaction.followUp({ 76 | embeds: [ 77 | embed('Successfully muted ' + member.user.toString() + '!', 'info') 78 | ] 79 | }); 80 | 81 | await interaction.channel.send({ 82 | embeds: [ 83 | embed(`${member.user.toString()} has been **muted** with the ID: \`${interaction.id}\``, 'warn') 84 | ] 85 | }); 86 | 87 | } catch (e) { 88 | console.error(e); 89 | 90 | await interaction.editReply({ 91 | embeds: [ 92 | embed('Unable to run the command properly, please check the console.', 'error') 93 | ] 94 | }); 95 | }; 96 | } 97 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/slowmode.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, SlashCommandBuilder, TextChannel } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import ms from 'ms'; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('slowmode') 9 | .setDescription('Set/Default slowmode') 10 | .addSubcommand((sub) => 11 | sub.setName('set') 12 | .setDescription('Set the current channel\'s slowmode.') 13 | .addStringOption((opt) => 14 | opt.setName('time') 15 | .setDescription('The time of the slowmode') 16 | .setRequired(true) 17 | ) 18 | ) 19 | .addSubcommand((sub) => 20 | sub.setName('get') 21 | .setDescription('Get the slowmode of the current channel.') 22 | ) 23 | .addSubcommand((sub) => 24 | sub.setName('disable') 25 | .setDescription('Disable current channel\'s slowmode.') 26 | ) 27 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 28 | .setDMPermission(false), 29 | async (client, interaction) => { 30 | 31 | try { 32 | switch (interaction.options.getSubcommand()) { 33 | case 'set': { 34 | const time = Math.floor(ms(interaction.options.getString('time', true)) / 1000); 35 | 36 | await interaction.deferReply(); 37 | 38 | await (interaction.channel as TextChannel).setRateLimitPerUser(time).catch(() => { }); 39 | 40 | await interaction.followUp({ 41 | embeds: [ 42 | embed(`The new slowmode for the channel ${interaction.channel.toString()} is: **${ms(time * 1000, { long: true })}**.`, 'info') 43 | ] 44 | }); 45 | 46 | break; 47 | }; 48 | 49 | case 'get': { 50 | await interaction.deferReply(); 51 | 52 | const slowmode = (interaction.channel as TextChannel).rateLimitPerUser * 1000; 53 | 54 | if (slowmode <= 0) { 55 | await interaction.followUp({ 56 | embeds: [ 57 | embed(`The slowmode is currently disabled in the channel ${interaction.channel.toString()}.`, 'none') 58 | ] 59 | }); 60 | 61 | return; 62 | }; 63 | 64 | await interaction.followUp({ 65 | embeds: [ 66 | embed(`The current slowmode of the channel ${interaction.channel.toString()} is: **${ms(slowmode, { long: true })}**.`, 'none') 67 | ] 68 | }); 69 | 70 | break; 71 | }; 72 | 73 | case 'disable': { 74 | await interaction.deferReply(); 75 | 76 | await (interaction.channel as TextChannel).setRateLimitPerUser(0); 77 | 78 | await interaction.followUp({ 79 | embeds: [ 80 | embed(`Disabled slowmode for the channel ${interaction.channel.toString()}.`, 'info') 81 | ] 82 | }); 83 | 84 | break; 85 | }; 86 | }; 87 | 88 | } catch (e) { 89 | console.error(e); 90 | 91 | await interaction.editReply({ 92 | embeds: [ 93 | embed('Unable to run the command properly, please check the console.', 'error') 94 | ] 95 | }); 96 | }; 97 | } 98 | ); -------------------------------------------------------------------------------- /src/func/index.ts: -------------------------------------------------------------------------------- 1 | import { ChatInputCommandInteraction, EmbedBuilder, GuildMember } from "discord.js"; 2 | import { client } from ".."; 3 | 4 | export const embed = (message: string, type?: 'error' | 'info' | 'warn' | 'loading' | 'none', footer?: string) => { 5 | switch (type) { 6 | case 'error': { 7 | return new EmbedBuilder() 8 | .setDescription(message) 9 | .setFooter(footer ? { text: footer } : null) 10 | .setColor('Red'); 11 | }; 12 | 13 | case 'warn': { 14 | return new EmbedBuilder() 15 | .setDescription(message) 16 | .setFooter(footer ? { text: footer } : null) 17 | .setColor('Yellow'); 18 | }; 19 | 20 | case 'info': { 21 | return new EmbedBuilder() 22 | .setDescription(message) 23 | .setFooter(footer ? { text: footer } : null) 24 | .setColor('#04fb9b'); 25 | }; 26 | 27 | case 'loading': { 28 | return new EmbedBuilder() 29 | .setDescription(':arrows_counterclockwise: ' + message) 30 | .setFooter(footer ? { text: footer } : null); 31 | }; 32 | 33 | default: { 34 | return new EmbedBuilder() 35 | .setDescription(message) 36 | .setFooter(footer ? { text: footer } : null); 37 | }; 38 | }; 39 | }; 40 | 41 | export const infractionRemover = () => { 42 | client.guilds.cache.forEach(async (guild) => { 43 | const data = await client.db.infraction.findMany({ 44 | where: { 45 | guildId: guild.id 46 | } 47 | }); 48 | 49 | if (!data) return; 50 | 51 | data.forEach(async (infraction) => { 52 | if (!infraction.expires) return; 53 | 54 | // Whenever the date of the expires date (of the infraction) is lower or equal to current date, it will be removed. 55 | if (Date.now() >= infraction.expires) { 56 | await client.db.infraction.deleteMany({ 57 | where: { 58 | guildId: guild.id, 59 | userId: infraction.userId, 60 | id: infraction.id 61 | } 62 | }); 63 | }; 64 | }); 65 | }); 66 | }; 67 | 68 | export const automodInfractionRemover = () => { 69 | client.guilds.cache.forEach(async (guild) => { 70 | const data = await client.db.automodInfraction.findMany({ 71 | where: { 72 | guildId: guild.id 73 | } 74 | }); 75 | 76 | if (!data) return; 77 | 78 | data.forEach(async (infraction) => { 79 | if (!infraction.expires) return; 80 | 81 | // Whenever the date of the expires date (of the infraction) is lower or equal to current date, it will be removed. 82 | if (Date.now() >= infraction.expires) { 83 | await client.db.automodInfraction.deleteMany({ 84 | where: { 85 | guildId: guild.id, 86 | userId: infraction.userId, 87 | id: infraction.id 88 | } 89 | }); 90 | }; 91 | }); 92 | }); 93 | }; 94 | 95 | export const checkCC = async (interaction: ChatInputCommandInteraction): Promise => { 96 | const data = (await client.db.customCommand.findMany({ 97 | where: { 98 | name: interaction.commandName, 99 | guildId: interaction.guildId 100 | } 101 | }))[0]; 102 | 103 | if (!data) return; 104 | 105 | await interaction.reply({ 106 | content: `${data.content}` 107 | }); 108 | 109 | return; 110 | }; 111 | 112 | export const protectedRolesChecker = (member: GuildMember, roles: string[]): boolean => { 113 | if (!member) return false; 114 | if (roles.length <= 0) return false; 115 | 116 | let check = false; 117 | 118 | for (const role of roles) { 119 | if (member.roles.cache.has(role)) { 120 | check = true; 121 | break; 122 | }; 123 | }; 124 | 125 | return check; 126 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # T.F.A's Utilities (Open-source version) 2 | 3 | **T.F.A's Utilities** is a powerful and advanced Discord moderation bot built for **T.F.A 7524 - Development**. This project uses [Prisma ORM](https://www.prisma.io/) and [discord.js](https://npmjs.com/package/discord.js) v14, and the main database SQLite. You can change the database to another one (examples: MongoDB, PostgreSQL... etc.) but you need to edit the model in `prisma/schema.prisma`. 4 | 5 | > **Warning** This bot is made for a single-server only. If you make your bot public, you need a huge database and some other configuration for the commands. This bot is **NOT** made for public servers. 6 | 7 | 8 | 9 | 10 | ## Features 11 | 12 | ### Administration 13 | - Custom slash (`/`) commands (5 max) 14 | 15 | ### Auto-moderation 16 | - Anti-swear 17 | - Anti-link 18 | - Anti-Discord server invites 19 | - Anti-caps 20 | - Anti-mass mention 21 | - Anti-walls (number of lines per message) 22 | - Anti-emoji spam (number of emojis per message) 23 | - Anti-IP addresses (avoid any IPv4 or/and IPv6 in any message) 24 | - Message update anti-bypasser (avoid members to bypass automod by editing their messages) 25 | 26 | ### Moderation 27 | - Auto-mod infractions 28 | - Infractions 29 | - Automod 30 | - 3x warnings: 3h timeout 31 | - Infractions expiration time 32 | - Automod 33 | - Warning: 6h 34 | - Mute: Permanent 35 | - Manual 36 | - Warning: 7d / Permanent 37 | - Mute: Permanent 38 | - Ban: Permanent 39 | - Kick: Permanent 40 | - Slowmode 41 | - Channel lock & unlock 42 | - Server lockdown & unlock 43 | - Yeet (troll command) 44 | - Note system 45 | - Protected moderator roles (avoid staff members to punish other staff members) 46 | 47 | ### Utility 48 | - AFK system 49 | - Welcome system & autorole 50 | - Server & user info 51 | - Help with mentionable commands & autocomplete options 52 | 53 | ## Setup 54 | 55 | 1. Run the following command to initialize a new package: 56 | ``` 57 | npm init -y 58 | ``` 59 | 60 | 2. Install **typescript**, **prisma**, and **@types/ms** as dev dependencies: 61 | ``` 62 | npm install --save-dev typescript prisma @types/ms 63 | ``` 64 | 65 | 3. Run a migration to create your database tables with prisma: ([Learn more here](https://www.prisma.io/docs/getting-started/quickstart)) 66 | ``` 67 | npx prisma migrate dev --name init 68 | ``` 69 | 70 | 4. Install other required packages: 71 | 72 | ``` 73 | npm install @prisma/client aqify.js axios discord.js dotenv ms 74 | ``` 75 | 76 | 5. Rename `.env.example` to `.env` and `example.config.ts` (in `src/`) to `config.ts`, and then fill all required values in each file. 77 | 78 | **.env**: 79 | ```apache 80 | # The database URL ("file:./dev.db" for SQLite) 81 | DATABASE_URL="file:./dev.db" 82 | 83 | # The Discord bot token 84 | CLIENT_TOKEN="" 85 | # The Discord bot ID 86 | CLIENT_ID="" 87 | 88 | # The developer ID (You) 89 | OWNER_ID="" 90 | ``` 91 | 92 | **config.ts**: 93 | ```ts 94 | export default { 95 | lockdown: { 96 | // The channel IDs to update whenever the server is on lockdown. 97 | channels: string[] 98 | }, 99 | moderation: { 100 | // The role IDs to protect other staff members whenever a staff tries to punish them. 101 | protectedRoles: string[] 102 | }, 103 | automod: { 104 | // The role IDs to ignore people (have at least one of the roles) who breaks the automod rules. 105 | protectedRoles: string[] 106 | } 107 | }; 108 | ``` 109 | 110 | 6. Run the following command to compile the TypeScript files into JavaScript files, and then starts from the main file `lib/index.js`. 111 | 112 | ``` 113 | npm run build 114 | ``` 115 | 116 | ## Developers 117 | - [TFAGaming](https://www.github.com/TFAGaming) 118 | 119 | ## License 120 | [GPL-3.0](./LICENSE), General Public License v3.0 -------------------------------------------------------------------------------- /src/class/ExtendedClient.ts: -------------------------------------------------------------------------------- 1 | import { Client, GatewayIntentBits, Collection, Partials, REST, Routes, ClientEvents } from "discord.js"; 2 | import { Command, Event } from "./Builders"; 3 | import { readdirSync } from 'fs'; 4 | import { PrismaClient } from "@prisma/client"; 5 | import { automodInfractionRemover, infractionRemover } from "../func"; 6 | 7 | export default class extends Client { 8 | public commands: Collection = new Collection(); 9 | public categories: Collection = new Collection(); 10 | public db: PrismaClient = new PrismaClient(); 11 | 12 | constructor() { 13 | super({ 14 | intents: [ 15 | GatewayIntentBits.Guilds, 16 | GatewayIntentBits.GuildMembers, 17 | GatewayIntentBits.GuildEmojisAndStickers, 18 | GatewayIntentBits.GuildIntegrations, 19 | GatewayIntentBits.GuildWebhooks, 20 | GatewayIntentBits.GuildModeration, 21 | GatewayIntentBits.GuildInvites, 22 | GatewayIntentBits.GuildVoiceStates, 23 | GatewayIntentBits.GuildPresences, 24 | GatewayIntentBits.GuildMessages, 25 | GatewayIntentBits.GuildMessageReactions, 26 | GatewayIntentBits.GuildMessageTyping, 27 | GatewayIntentBits.DirectMessages, 28 | GatewayIntentBits.DirectMessageReactions, 29 | GatewayIntentBits.DirectMessageTyping, 30 | GatewayIntentBits.MessageContent 31 | ], 32 | partials: [ 33 | Partials.Message, 34 | Partials.Channel, 35 | Partials.GuildMember, 36 | Partials.User 37 | ], 38 | presence: { 39 | activities: [{ 40 | name: '/help for help!' 41 | }], 42 | status: 'online' 43 | } 44 | }); 45 | }; 46 | 47 | public async load() { 48 | for (let dir of readdirSync('./dist/commands/')) { 49 | this.categories.set(dir, []); 50 | 51 | for (let file of readdirSync('./dist/commands/' + dir + '/').filter((f) => f.endsWith('.js'))) { 52 | const module: Command = require('../commands/' + dir + '/' + file).default; 53 | 54 | this.commands.set(module.structure.name, module); 55 | 56 | const data = this.categories.get(dir); 57 | data.push(module.structure.name); 58 | this.categories.set(dir, data); 59 | 60 | console.log('Loaded new command: ' + file); 61 | }; 62 | }; 63 | 64 | for (let dir of readdirSync('./dist/events/')) { 65 | for (let file of readdirSync('./dist/events/' + dir + '/').filter((f) => f.endsWith('.js'))) { 66 | const module: Event = require('../events/' + dir + '/' + file).default; 67 | 68 | if (module.once) { 69 | this.once(module.event, (...args) => module.run(...args)); 70 | } else { 71 | this.on(module.event, (...args) => module.run(...args)); 72 | }; 73 | 74 | console.log('Loaded new event: ' + file); 75 | }; 76 | }; 77 | }; 78 | 79 | public async deploy() { 80 | try { 81 | const rest = new REST({ version: '10' }).setToken(process.env.CLIENT_TOKEN); 82 | 83 | const commands = [...this.commands.values()]; 84 | 85 | console.log('Loading application commands...'); 86 | 87 | await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), { 88 | body: commands.map((s) => s.structure) 89 | }); 90 | 91 | console.log('Loaded application commands.'); 92 | } catch { 93 | console.log('Unable to load application commands.'); 94 | }; 95 | }; 96 | 97 | public async start() { 98 | this.load(); 99 | await this.login(process.env.CLIENT_TOKEN); 100 | await this.deploy(); 101 | 102 | setInterval(() => { 103 | infractionRemover(); 104 | automodInfractionRemover(); 105 | }, 3000); 106 | }; 107 | }; -------------------------------------------------------------------------------- /src/commands/Utility/userinfo.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import axios from "axios"; 4 | import { embed } from "../../func"; 5 | import { time } from "aqify.js"; 6 | 7 | export default new Command( 8 | new SlashCommandBuilder() 9 | .setName('userinfo') 10 | .setDescription('Get a user\'s information.') 11 | .addUserOption((opt) => 12 | opt.setName('user') 13 | .setDescription('The user to get their info.') 14 | .setRequired(false) 15 | ) 16 | .setDMPermission(false), 17 | async (client, interaction, db) => { 18 | 19 | const user = interaction.options.getUser('user') || interaction.user; 20 | const member = interaction.guild.members.cache.get(user.id); 21 | 22 | await interaction.deferReply(); 23 | 24 | if (!member) { 25 | await interaction.followUp({ 26 | embeds: [ 27 | embed('That user is not on the server.', 'error') 28 | ] 29 | }); 30 | 31 | return; 32 | }; 33 | 34 | /* 35 | You can change the emojis if you want by replacing the current emoji string to another custom emoji string. 36 | */ 37 | const emojis = { 38 | Partner: '<:DiscordPartner:1108509450052063272>', 39 | Staff: '<:DiscordStaff:1108509676456378458>', 40 | Hypesquad: '<:HypesquadEvents:1108509259609673779>', // <= The Hypesquad gold 41 | BugHunterLevel1: '<:BugHunter:1108510903369994340>', // <= Green bug hunter 42 | BugHunterLevel2: '<:BugHunterGold:1108510932923068529>', // <= Gold bug hunter 43 | HypeSquadOnlineHouse1: '<:HypesquadBravery:1108509164327669780>', // <= Purple one 44 | HypeSquadOnlineHouse2: '<:HypesquadBrilliance:1108509194878984242>', // <= Orange one 45 | HypeSquadOnlineHouse3: '<:HypesquadBalance:1108509100431650907>', // <= Green one 46 | ActiveDeveloper: '<:ActiveDeveloper:1108509324059344937>', 47 | CertifiedModerator: '<:CertifiedDiscordModerator:1108510159489208421>', 48 | PremiumEarlySupporter: '<:EarlySupporter:1108509973186613320>', // <= Early supporter 49 | VerifiedDeveloper: '<:EarlyVerifiedDiscordBotDev:1108509539269087253>', 50 | NitroSubscription: '<:NitroSubscription:1108509587704926319>', 51 | SlashCommandsSupport: '<:SupportsCommands:1125396330764841011>', 52 | OriginallyKnownAs: '<:OriginallyKnownAs:1128995669726740510>' 53 | }; 54 | 55 | let isBotAndVerified = false; 56 | let badges: string[] = []; 57 | 58 | // This HTTP Client requests for user info, and used on this command to detect if a user has Nitro subscription or not. 59 | const userData = await axios('https://japi.rest/discord/v1/user/' + user.id); 60 | const { data } = userData.data; 61 | 62 | if (data.public_flags_array) { 63 | await Promise.all(data.public_flags_array.map(async (badge: string) => { 64 | if (badge === 'NITRO') badges.push(emojis['NitroSubscription']); 65 | if (badge === 'VERIFIED_BOT') isBotAndVerified = true; 66 | })); 67 | }; 68 | 69 | const badgesFetched = user.flags?.toArray(); 70 | 71 | badgesFetched?.forEach((badge) => { 72 | if (badge in emojis) badges.push(emojis[badge]); 73 | }); 74 | 75 | if (user.bot) badges.push(emojis['SlashCommandsSupport']); 76 | if (user.discriminator === '0') badges.push(emojis['OriginallyKnownAs']); 77 | 78 | await interaction.followUp({ 79 | embeds: [ 80 | new EmbedBuilder() 81 | .setTitle('User Info - ' + user.username + (isBotAndVerified ? ' <:VerifiedBot:1127954811371925545>' : '')) 82 | .setThumbnail(user.displayAvatarURL()) 83 | .setDescription(`**Username**: ${user.username}\n**Display name**: ${user.displayName}\n**ID**: ${user.id}\n**Nickname**: ${member.nickname ? member.nickname : 'None'}\n**Joined at**: ${time(member.joinedTimestamp, 'D')}\n**Created at**: ${time(user.createdTimestamp, 'D')}\n**Server booster**: ${member.premiumSince ? 'Yes' : 'No'}\n**Bot**: ${user.bot ? 'Yes' : 'No'}\n**Badges**: ${badges.join(' ')}\n**Guild owner**: ${user.id === interaction.guild.ownerId ? 'Yes' : 'No'}`) 84 | .setColor('Blurple') 85 | ] 86 | }); 87 | } 88 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/channel lock unlock.ts: -------------------------------------------------------------------------------- 1 | import { ChannelType, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('channel') 8 | .setDescription('Lock and unlock system.') 9 | .addSubcommand((s) => 10 | s.setName('lock') 11 | .setDescription('Lock a channel.') 12 | .addChannelOption((opt) => 13 | opt.setName('channel') 14 | .setDescription('The channel to lock.') 15 | .addChannelTypes( 16 | ChannelType.GuildText 17 | ) 18 | .setRequired(false) 19 | ) 20 | .addStringOption((o) => 21 | o.setName('reason') 22 | .setDescription('The reason of the lock.') 23 | .setRequired(false) 24 | ) 25 | ) 26 | .addSubcommand((s) => 27 | s.setName('unlock') 28 | .setDescription('Unlock a channel.') 29 | .addChannelOption((opt) => 30 | opt.setName('channel') 31 | .setDescription('The channel to unlock.') 32 | .addChannelTypes( 33 | ChannelType.GuildText 34 | ) 35 | .setRequired(false) 36 | ) 37 | .addStringOption((o) => 38 | o.setName('reason') 39 | .setDescription('The reason of the unlock.') 40 | .setRequired(false) 41 | ) 42 | ) 43 | .setDMPermission(false), 44 | async (client, interaction, db) => { 45 | 46 | await interaction.deferReply({ ephemeral: true }); 47 | 48 | switch (interaction.options.getSubcommand()) { 49 | case 'lock': { 50 | const channel = (interaction.options.getChannel('channel') || interaction.channel) as TextChannel; 51 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 52 | 53 | await channel.permissionOverwrites.edit(interaction.guild.roles.everyone.id, { 54 | SendMessages: false, 55 | AddReactions: false, 56 | CreatePublicThreads: false, 57 | CreatePrivateThreads: false 58 | }); 59 | 60 | await interaction.followUp({ 61 | embeds: [ 62 | embed(`${channel.toString()} has been locked!`, 'info') 63 | ] 64 | }); 65 | 66 | await interaction.channel.send({ 67 | embeds: [ 68 | new EmbedBuilder() 69 | .setTitle('Channel Locked') 70 | .setDescription(`This channel has been locked by a staff, you are **not** muted, **no one can talk here**.`) 71 | .addFields({ name: 'Lock reason', value: reason }) 72 | .setFooter({ 73 | text: 'Please do not contact any staff members to ask why, updates by administrators will be posted here eventually.' 74 | }) 75 | .setColor('Yellow') 76 | ] 77 | }); 78 | 79 | break; 80 | }; 81 | 82 | case 'unlock': { 83 | const channel = (interaction.options.getChannel('channel') || interaction.channel) as TextChannel; 84 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 85 | 86 | await channel.permissionOverwrites.edit(interaction.guild.roles.everyone.id, { 87 | SendMessages: null, 88 | AddReactions: null, 89 | CreatePublicThreads: null, 90 | CreatePrivateThreads: null 91 | }); 92 | 93 | await interaction.followUp({ 94 | embeds: [ 95 | embed(`${channel.toString()} has been unlocked!`, 'info') 96 | ] 97 | }); 98 | 99 | await interaction.channel.send({ 100 | embeds: [ 101 | new EmbedBuilder() 102 | .setTitle('Channel Unlocked') 103 | .setDescription(`This channel has been unlocked by a staff, you are allowed to chat again.`) 104 | .addFields({ name: 'Unlock reason', value: reason }) 105 | .setColor('Green') 106 | ] 107 | }); 108 | 109 | break; 110 | }; 111 | }; 112 | 113 | } 114 | ); 115 | -------------------------------------------------------------------------------- /src/commands/Moderation/server lockdown unlock.ts: -------------------------------------------------------------------------------- 1 | import { ChannelType, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import config from "../../config"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('server') 9 | .setDescription('Lockdown and unlock system.') 10 | .addSubcommand((s) => 11 | s.setName('lockdown') 12 | .setDescription('Disable the permissions from members to chat in all channels.') 13 | .addStringOption((o) => 14 | o.setName('reason') 15 | .setDescription('The reason of the lockdown.') 16 | .setRequired(false) 17 | ) 18 | ) 19 | .addSubcommand((s) => 20 | s.setName('unlock') 21 | .setDescription('Unlock the server.') 22 | .addStringOption((o) => 23 | o.setName('reason') 24 | .setDescription('The reason of the unlock.') 25 | .setRequired(false) 26 | ) 27 | ) 28 | .setDMPermission(false), 29 | async (client, interaction, db) => { 30 | 31 | await interaction.deferReply({ ephemeral: true }); 32 | 33 | switch (interaction.options.getSubcommand()) { 34 | case 'lockdown': { 35 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 36 | 37 | await interaction.channel.send({ 38 | content: ':rotating_light: Server lockdown started.' 39 | }); 40 | 41 | for (const channel of config.lockdown.channels) { 42 | const channelFetch = (interaction.guild.channels.cache.find((x) => x.id === channel && x.type === 0)) as TextChannel; 43 | 44 | await channelFetch.permissionOverwrites.edit(interaction.guild.roles.everyone.id, { 45 | SendMessages: false, 46 | AddReactions: false, 47 | CreatePublicThreads: false, 48 | CreatePrivateThreads: false 49 | }); 50 | 51 | if (channelFetch.id !== interaction.channel.id) await channelFetch.send({ 52 | content: ':lock: The server is currently in lockdown, please check ' + interaction.channel.toString() + ' for updates.' 53 | }); 54 | }; 55 | 56 | await interaction.followUp({ 57 | embeds: [ 58 | embed(`The server has been locked down!`, 'info') 59 | ] 60 | }); 61 | 62 | await interaction.channel.send({ 63 | embeds: [ 64 | new EmbedBuilder() 65 | .setTitle('Server Lockdown') 66 | .setDescription(`The server is in lock down, you are **not** muted, **no one can talk here**.`) 67 | .addFields({ name: 'Lock reason', value: reason }) 68 | .setFooter({ 69 | text: 'Please do not contact any staff members to ask why, updates by administrators will be posted here eventually.' 70 | }) 71 | .setColor('Red') 72 | ] 73 | }); 74 | 75 | break; 76 | }; 77 | 78 | case 'unlock': { 79 | const reason = interaction.options.getString('reason') || 'No reason was provided'; 80 | 81 | for (const channel of config.lockdown.channels) { 82 | const channelFetch = (interaction.guild.channels.cache.find((x) => x.id === channel && x.type === 0)) as TextChannel; 83 | 84 | await channelFetch.permissionOverwrites.edit(interaction.guild.roles.everyone.id, { 85 | SendMessages: null, 86 | AddReactions: null, 87 | CreatePublicThreads: null, 88 | CreatePrivateThreads: null 89 | }); 90 | }; 91 | 92 | await interaction.followUp({ 93 | embeds: [ 94 | embed(`The server has been unlocked!`, 'info') 95 | ] 96 | }); 97 | 98 | await interaction.channel.send({ 99 | embeds: [ 100 | new EmbedBuilder() 101 | .setTitle('Server Unlocked') 102 | .setDescription(`The server has been unlocked, you are allowed to chat again.`) 103 | .addFields({ name: 'Unlock reason', value: reason }) 104 | .setColor('Green') 105 | ] 106 | }); 107 | 108 | break; 109 | }; 110 | }; 111 | 112 | } 113 | ); 114 | -------------------------------------------------------------------------------- /src/commands/Moderation/purge.ts: -------------------------------------------------------------------------------- 1 | import { ChannelType, Message, PermissionFlagsBits, SlashCommandBuilder, TextChannel } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed, protectedRolesChecker } from "../../func"; 4 | import config from "../../config"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('purge') 9 | .setDescription('Purge system.') 10 | .addSubcommandGroup((sub) => 11 | sub.setName('user') 12 | .setDescription('Purge user messages.') 13 | .addSubcommand((sub) => 14 | sub.setName('messages') 15 | .setDescription('Purge user messages.') 16 | .addUserOption((opt) => 17 | opt.setName('user') 18 | .setDescription('The user to delete their messages.') 19 | .setRequired(true) 20 | ) 21 | .addNumberOption((opt) => 22 | opt.setName('amount') 23 | .setDescription('The amount of messages to delete.') 24 | .setMaxValue(100) 25 | .setMinValue(1) 26 | .setRequired(true) 27 | ) 28 | ) 29 | ) 30 | .addSubcommandGroup((sub) => 31 | sub.setName('channel') 32 | .setDescription('Purge channel messages.') 33 | .addSubcommand((sub) => 34 | sub.setName('messages') 35 | .setDescription('Purge channel messages.') 36 | .addNumberOption((opt) => 37 | opt.setName('amount') 38 | .setDescription('The amount of messages to delete.') 39 | .setMaxValue(100) 40 | .setMinValue(1) 41 | .setRequired(true) 42 | ) 43 | .addChannelOption((opt) => 44 | opt.setName('channel') 45 | .setDescription('The channel to purge the messages.') 46 | .addChannelTypes( 47 | ChannelType.GuildText 48 | ) 49 | .setRequired(false) 50 | ) 51 | ) 52 | ) 53 | .setDMPermission(false) 54 | .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), 55 | async (client, interaction) => { 56 | await interaction.deferReply({ ephemeral: true }); 57 | 58 | try { 59 | switch (interaction.options.getSubcommandGroup()) { 60 | case 'user': { 61 | const user = interaction.options.getUser('user', true); 62 | const amount = interaction.options.getNumber('amount', true); 63 | 64 | if (protectedRolesChecker(interaction.guild.members.cache.get(user.id), config.moderation.protectedRoles)) { 65 | await interaction.followUp({ 66 | embeds: [ 67 | embed('You cannot delete that user\'s messages.', 'error') 68 | ] 69 | }); 70 | 71 | return; 72 | }; 73 | 74 | if (!amount) { 75 | await interaction.followUp({ 76 | embeds: [ 77 | embed('Invalid amount provided.', 'error') 78 | ] 79 | }); 80 | 81 | return; 82 | }; 83 | 84 | const messages = await interaction.channel?.messages.fetch({ 85 | limit: amount || 0 86 | }); 87 | 88 | let index = 0; 89 | const filtered: Message[] = []; 90 | 91 | messages?.forEach((msg) => { 92 | if (msg.author.id === user?.id && amount > index) { 93 | filtered.push(msg); 94 | 95 | index++; 96 | }; 97 | }); 98 | 99 | await (interaction.channel as TextChannel)?.bulkDelete(filtered); 100 | 101 | await interaction.followUp({ 102 | embeds: [ 103 | embed(`Successfully deleted **${filtered.length}** messages from ${user.toString()}.`, 'info') 104 | ] 105 | }); 106 | 107 | break; 108 | }; 109 | 110 | case 'channel': { 111 | const amount = interaction.options.getNumber('amount', true); 112 | const channel = interaction.options.getChannel('channel') || interaction.channel; 113 | 114 | await (channel as TextChannel).bulkDelete(amount); 115 | 116 | await interaction.followUp({ 117 | embeds: [ 118 | embed(`Successfully deleted **${amount}** messages in ${channel.toString()}.`, 'info') 119 | ] 120 | }); 121 | 122 | break; 123 | }; 124 | }; 125 | } catch (e) { 126 | console.error(e); 127 | 128 | await interaction.editReply({ 129 | embeds: [ 130 | embed('Unable to run the command properly, please check the console.', 'error') 131 | ] 132 | }); 133 | }; 134 | } 135 | ); 136 | -------------------------------------------------------------------------------- /src/commands/Utility/help.ts: -------------------------------------------------------------------------------- 1 | import { ApplicationCommandOptionChoiceData, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, StringSelectMenuBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { DropdownPaginatorBuilder, DropdownPaginatorStructureOptionsBuilder, SendMethod, time } from "aqify.js"; 4 | import { embed } from "../../func"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('help') 9 | .setDescription('Get all commands info.') 10 | .addStringOption((opt) => 11 | opt.setName('command') 12 | .setDescription('Get info of a specific command.') 13 | .setAutocomplete(true) 14 | .setRequired(false) 15 | ) 16 | .setDMPermission(false), 17 | async (client, interaction) => { 18 | 19 | const commandInput = interaction.options.getString('command'); 20 | 21 | await interaction.deferReply(); 22 | 23 | if (commandInput) { 24 | const command = client.commands.get(commandInput); 25 | 26 | if (!command) { 27 | await interaction.followUp({ 28 | embeds: [ 29 | embed('No command found with the name of **' + commandInput + '**.', 'error') 30 | ] 31 | }); 32 | 33 | return; 34 | }; 35 | 36 | 37 | await interaction.followUp({ 38 | embeds: [ 39 | new EmbedBuilder() 40 | .setTitle('Command Info - /' + commandInput) 41 | .setDescription(`**Owner only**: ${command.options?.ownerOnly ? 'Yes' : 'No'}\n**Autocomplete**: ${command.options?.autocomplete ? 'Yes' : 'No'}\n**Sub commands**: ${command.structure.options.filter((v) => v.toJSON().type === 1).length}\n**Sub command groups**: ${command.structure.options.filter((v) => v.toJSON().type === 2).length}`) 42 | ] 43 | }) 44 | } else { 45 | const commandsFetched = await client.application?.commands?.fetch(); 46 | 47 | const commands: { name: string, id: string, suboption?: string, otheroption?: string, description: string }[] = []; 48 | 49 | commandsFetched?.forEach((cmd) => { 50 | if (cmd.type === 1) { 51 | if (cmd.options && cmd.options?.length > 0) { 52 | for (let option of cmd.options) { 53 | if (option.type === 2 && option.options) { 54 | for (let option2 of option.options) { 55 | commands.push({ 56 | name: cmd.name, 57 | id: cmd.id, 58 | suboption: option.name, 59 | otheroption: option2.name, 60 | description: option2.description 61 | }); 62 | }; 63 | } else if (option.type === 1) { 64 | commands.push({ 65 | name: cmd.name, 66 | id: cmd.id, 67 | suboption: option.name, 68 | description: option.description 69 | }); 70 | } else { 71 | commands.push({ 72 | name: cmd.name, 73 | id: cmd.id, 74 | description: cmd.description 75 | }); 76 | 77 | break; 78 | }; 79 | }; 80 | } else { 81 | commands.push({ 82 | name: cmd.name, 83 | id: cmd.id, 84 | description: cmd.description 85 | }); 86 | }; 87 | }; 88 | }); 89 | 90 | const paginator = new DropdownPaginatorBuilder(interaction, { 91 | time: (60000 * 3) 92 | }); 93 | 94 | const keys = [...client.categories.keys()]; 95 | const final: DropdownPaginatorStructureOptionsBuilder[] = []; 96 | 97 | keys.forEach((key) => { 98 | const toAdd: { cat: string, values: string[] } = { cat: key, values: [] }; 99 | const data = client.categories.get(key); 100 | 101 | commands.forEach((cmd) => { 102 | if (data.some((v) => v === cmd.name)) { 103 | toAdd.values.push(`: ${cmd.description}`) 104 | }; 105 | }); 106 | 107 | final.push({ 108 | component: { 109 | label: toAdd.cat 110 | }, 111 | message: { 112 | content: `**${toAdd.cat} commands:**\n\n${toAdd.values.join('\n')}` 113 | } 114 | }); 115 | }); 116 | 117 | paginator.addOptions(final); 118 | 119 | await paginator.send(SendMethod.FollowUp, 120 | new StringSelectMenuBuilder() 121 | .setCustomId('help_menu_' + interaction.id) 122 | .setPlaceholder('Select a module'), 123 | { 124 | onNotAuthor: async (i) => { 125 | await i.reply({ content: 'You are not the author of this interaction.' }); 126 | }, 127 | home: { 128 | content: 'Select a module from the select menu below.\nThis request expires in: ' + time(Date.now() + (60000 * 3), 'R') 129 | }, 130 | onEnd: { 131 | content: 'This paginator has been expired after 3 minutes of timeout.' 132 | } 133 | }); 134 | }; 135 | }, 136 | { 137 | autocomplete: async (client, interaction) => { 138 | const value = interaction.options.getFocused().toLocaleLowerCase(); 139 | 140 | const keys = [...client.commands.keys()]; 141 | 142 | const choices: ApplicationCommandOptionChoiceData[] = []; 143 | 144 | for (const key of keys) { 145 | choices.push({ 146 | name: key, 147 | value: key 148 | }) 149 | }; 150 | 151 | const filtered = choices.filter((choice) => choice.name.includes(value)).slice(0, 25); 152 | 153 | if (!interaction) return; 154 | 155 | await interaction.respond(filtered); 156 | } 157 | } 158 | ); -------------------------------------------------------------------------------- /src/commands/Moderation/note.ts: -------------------------------------------------------------------------------- 1 | import { EmbedBuilder, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | import { time } from "aqify.js"; 5 | 6 | export default new Command( 7 | new SlashCommandBuilder() 8 | .setName('note') 9 | .setDescription('Note system.') 10 | .addSubcommand((s) => 11 | s.setName('add') 12 | .setDescription('Add a note to a user.') 13 | .addUserOption((o) => 14 | o.setName('user') 15 | .setDescription('The user to add a new note.') 16 | .setRequired(true) 17 | ) 18 | .addStringOption((o) => 19 | o.setName('message') 20 | .setDescription('The message of the new note.') 21 | .setRequired(true) 22 | ) 23 | ) 24 | .addSubcommandGroup((s) => 25 | s.setName('update') 26 | .setDescription('Edit a note from a user.') 27 | .addSubcommand((s) => 28 | s.setName('message') 29 | .setDescription('Edit a note from a user.') 30 | .addUserOption((o) => 31 | o.setName('user') 32 | .setDescription('The user to update it\'s note message.') 33 | .setRequired(true) 34 | ) 35 | .addStringOption((o) => 36 | o.setName('new-message') 37 | .setDescription('The new message of the note.') 38 | .setRequired(true) 39 | ) 40 | ) 41 | ) 42 | .addSubcommand((s) => 43 | s.setName('view') 44 | .setDescription('View your note from a user.') 45 | .addUserOption((o) => 46 | o.setName('user') 47 | .setDescription('The user to view it\'s note.') 48 | .setRequired(true) 49 | ) 50 | ) 51 | .addSubcommand((s) => 52 | s.setName('delete') 53 | .setDescription('Delete your note from a user.') 54 | .addUserOption((o) => 55 | o.setName('user') 56 | .setDescription('The user to delete it\'s note.') 57 | .setRequired(true) 58 | ) 59 | ) 60 | .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) 61 | .setDMPermission(false), 62 | async (client, interaction, db) => { 63 | 64 | await interaction.deferReply({ ephemeral: true }); 65 | 66 | switch (interaction.options.getSubcommand()) { 67 | case 'add': { 68 | const user = interaction.options.getUser('user', true); 69 | const message = interaction.options.getString('message', true); 70 | 71 | const count = await db.note.count({ 72 | where: { 73 | guildId: interaction.guildId, 74 | authorId: interaction.user.id, 75 | userId: user.id 76 | } 77 | }); 78 | 79 | if (count >= 1) { 80 | await interaction.followUp({ 81 | embeds: [ 82 | embed(`There is a note already added to ${user.toString()}.`, 'error') 83 | ] 84 | }); 85 | 86 | return; 87 | }; 88 | 89 | await db.note.create({ 90 | data: { 91 | guildId: interaction.guildId, 92 | authorId: interaction.user.id, 93 | userId: interaction.user.id, 94 | message: message, 95 | since: BigInt(Date.now()) 96 | } 97 | }); 98 | 99 | await interaction.followUp({ 100 | embeds: [ 101 | embed(`Successfully added a new note to ${user.toString()}.`, 'info') 102 | ] 103 | }); 104 | 105 | break; 106 | }; 107 | 108 | // Must be 'message', not 'update'. 109 | case 'message': { 110 | const user = interaction.options.getUser('user', true); 111 | const message = interaction.options.getString('new-message', true); 112 | 113 | const count = await db.note.count({ 114 | where: { 115 | guildId: interaction.guildId, 116 | authorId: interaction.user.id, 117 | userId: user.id 118 | } 119 | }); 120 | 121 | if (count <= 0) { 122 | await interaction.followUp({ 123 | embeds: [ 124 | embed(`No note was created for ${user.toString()}.`, 'error') 125 | ] 126 | }); 127 | 128 | return; 129 | }; 130 | 131 | await db.note.updateMany({ 132 | where: { 133 | guildId: interaction.guildId, 134 | authorId: interaction.user.id, 135 | userId: user.id 136 | }, 137 | data: { 138 | message: message, 139 | edited: true 140 | } 141 | }); 142 | 143 | await interaction.followUp({ 144 | embeds: [ 145 | embed(`Successfully edited the note for ${user.toString()}.`, 'info') 146 | ] 147 | }); 148 | 149 | break; 150 | }; 151 | 152 | case 'view': { 153 | const user = interaction.options.getUser('user', true); 154 | 155 | const count = await db.note.count({ 156 | where: { 157 | guildId: interaction.guildId, 158 | authorId: interaction.user.id, 159 | userId: user.id 160 | } 161 | }); 162 | 163 | if (count <= 0) { 164 | await interaction.followUp({ 165 | embeds: [ 166 | embed(`No note was created for ${user.toString()}.`, 'error') 167 | ] 168 | }); 169 | 170 | return; 171 | }; 172 | 173 | const data = (await db.note.findMany({ 174 | where: { 175 | guildId: interaction.guildId, 176 | authorId: interaction.user.id, 177 | userId: user.id 178 | } 179 | }))[0]; 180 | 181 | await interaction.followUp({ 182 | embeds: [ 183 | new EmbedBuilder() 184 | .setAuthor({ 185 | name: `Note for ${user.username} ${data.edited ? '(edited)' : ''}`, 186 | iconURL: user.displayAvatarURL() 187 | }) 188 | .setDescription(`${time(Number(data.since), 'D')} — ` + data.message) 189 | .setFooter({ 190 | text: 'Nobody can see this note, except for you.' 191 | }) 192 | .setColor('Blurple') 193 | ] 194 | }); 195 | 196 | break; 197 | }; 198 | 199 | case 'delete': { 200 | const user = interaction.options.getUser('user', true); 201 | 202 | const count = await db.note.count({ 203 | where: { 204 | guildId: interaction.guildId, 205 | authorId: interaction.user.id, 206 | userId: user.id 207 | } 208 | }); 209 | 210 | if (count <= 0) { 211 | await interaction.followUp({ 212 | embeds: [ 213 | embed(`No note was created for ${user.toString()}.`, 'error') 214 | ] 215 | }); 216 | 217 | return; 218 | }; 219 | 220 | await db.note.deleteMany({ 221 | where: { 222 | guildId: interaction.guildId, 223 | authorId: interaction.user.id, 224 | userId: user.id 225 | } 226 | }); 227 | 228 | await interaction.followUp({ 229 | embeds: [ 230 | embed('Successfully deleted note for ' + user.toString() + '.', 'info') 231 | ] 232 | }) 233 | 234 | return; 235 | }; 236 | }; 237 | } 238 | ); 239 | -------------------------------------------------------------------------------- /src/events/Guild/automod.ts: -------------------------------------------------------------------------------- 1 | import ms from "ms"; 2 | import { client } from "../.."; 3 | import { Event } from "../../class/Builders"; 4 | import { embed, protectedRolesChecker } from "../../func"; 5 | import { ipRegex, wait } from "aqify.js"; 6 | import config from "../../config"; 7 | import { Message } from "discord.js"; 8 | 9 | // Every possible swear word and it's bypasses in the entire world tbh 10 | const swears = ["fucck", "4r5e", "5h1t", "5hit", "a55", "anal", "anus", "ar5e", "arrse", "arse", "ass", "ass-fucker", "asses", "assfucker", "assfukka", "asshole", "assholes", "asswhole", "a_s_s", "b!tch", "b00bs", "b17ch", "b1tch", "ballbag", "balls", "ballsack", "bastard", "beastial", "beastiality", "bellend", "bestial", "bestiality", "bi+ch", "biatch", "bitch", "bitcher", "bitchers", "bitches", "bitchin", "bitching", "bloody", "blow job", "blowjob", "blowjobs", "boiolas", "bollock", "bollok", "boner", "boob", "boobs", "booobs", "boooobs", "booooobs", "booooooobs", "breasts", "buceta", "bugger", "bum", "bunny fucker", "butt", "butthole", "buttmuch", "buttplug", "c0ck", "c0cksucker", "carpet muncher", "cawk", "chink", "cipa", "cl1t", "clit", "clitoris", "clits", "cnut", "cock", "cock-sucker", "cockface", "cockhead", "cockmunch", "cockmuncher", "cocks", "cocksuck", "cocksucked", "cocksucker", "cocksucking", "cocksucks", "cocksuka", "cocksukka", "cok", "cokmuncher", "coksucka", "coon", "cox", "crap", "cum", "cummer", "cumming", "cums", "cumshot", "cunilingus", "cunillingus", "cunnilingus", "cunt", "cuntlick", "cuntlicker", "cuntlicking", "cunts", "cyalis", "cyberfuc", "cyberfuck", "cyberfucked", "cyberfucker", "cyberfuckers", "cyberfucking", "d1ck", "dick", "dickhead", "dildo", "dildos", "dink", "dinks", "dirsa", "dlck", "dog-fucker", "doggin", "dogging", "donkeyribber", "doosh", "duche", "dyke", "ejaculate", "ejaculated", "ejaculates", "ejaculating", "ejaculatings", "ejaculation", "ejakulate", "f u c k", "f u c k e r", "fag", "fagging", "faggitt", "faggot", "faggs", "fagot", "fagots", "fags", "fanny", "fannyflaps", "fannyfucker", "fanyy", "fatass", "fcuk", "fcuker", "fcuking", "feck", "fecker", "felching", "fellate", "fellatio", "fingerfuck", "fingerfucked", "fingerfucker", "fingerfuckers", "fingerfucking", "fingerfucks", "fistfuck", "fistfucked", "fistfucker", "fistfuckers", "fistfucking", "fistfuckings", "fistfucks", "flange", "fook", "fooker", "fuck", "fucka", "fucked", "fucker", "fuckers", "fuckhead", "fuckheads", "fuckin", "fucking", "fuckings", "fuckingshitmotherfucker", "fuckme", "fucks", "fuckwhit", "fuckwit", "fudge packer", "fudgepacker", "fuk", "fuker", "fukker", "fukkin", "fuks", "fukwhit", "fukwit", "fux", "fux0r", "f_u_c_k", "gangbang", "gangbanged", "gangbangs", "gaylord", "gaysex", "goatse", "God", "god-dam", "god-damned", "goddamn", "goddamned", "hardcoresex", "heshe", "hoar", "hoare", "hoer", "homo", "hore", "horniest", "horny", "hotsex", "jack-off", "jackoff", "jap", "jerk-off", "jism", "jiz", "jizm", "jizz", "kawk", "knob", "knobead", "knobed", "knobend", "knobhead", "knobjocky", "knobjokey", "kock", "kondum", "kondums", "kum", "kummer", "kumming", "kums", "kunilingus", "l3i+ch", "l3itch", "labia", "lust", "lusting", "m0f0", "m0fo", "m45terbate", "ma5terb8", "ma5terbate", "masochist", "master-bate", "masterb8", "masterbat*", "masterbat3", "masterbate", "masterbation", "masterbations", "masturbate", "mo-fo", "mof0", "mofo", "mothafuck", "mothafucka", "mothafuckas", "mothafuckaz", "mothafucked", "mothafucker", "mothafuckers", "mothafuckin", "mothafucking", "mothafuckings", "mothafucks", "mother fucker", "motherfuck", "motherfucked", "motherfucker", "motherfuckers", "motherfuckin", "motherfucking", "motherfuckings", "motherfuckka", "motherfucks", "muff", "mutha", "muthafecker", "muthafuckker", "muther", "mutherfucker", "n1gga", "n1gger", "nazi", "nigg3r", "nigg4h", "nigga", "niggah", "niggas", "niggaz", "nigger", "niggers", "nob", "nob jokey", "nobhead", "nobjocky", "nobjokey", "numbnuts", "nutsack", "orgasim", "orgasims", "orgasm", "orgasms", "p0rn", "pawn", "pecker", "penis", "penisfucker", "phonesex", "phuck", "phuk", "phuked", "phuking", "phukked", "phukking", "phuks", "phuq", "pigfucker", "pimpis", "piss", "pissed", "pisser", "pissers", "pisses", "pissflaps", "pissin", "pissing", "pissoff", "poop", "porn", "porno", "pornography", "pornos", "prick", "pricks", "pron", "pube", "pusse", "pussi", "pussies", "pussy", "pussys", "rectum", "retard", "rimjaw", "rimming", "s hit", "s.o.b.", "sadist", "schlong", "screwing", "scroat", "scrote", "scrotum", "semen", "sex", "sh!+", "sh!t", "sh1t", "shag", "shagger", "shaggin", "shagging", "shemale", "shi+", "shit", "shitdick", "shite", "shited", "shitey", "shitfuck", "shitfull", "shithead", "shiting", "shitings", "shits", "shitted", "shitter", "shitters", "shitting", "shittings", "shitty", "skank", "slut", "sluts", "smegma", "smut", "snatch", "son-of-a-bitch", "spac", "spunk", "s_h_i_t", "t1tt1e5", "t1tties", "teets", "teez", "testical", "testicle", "tit", "titfuck", "tits", "titt", "tittie5", "tittiefucker", "titties", "tittyfuck", "tittywank", "titwank", "tosser", "turd", "tw4t", "twat", "twathead", "twatty", "twunt", "twunter", "v14gra", "v1gra", "vagina", "viagra", "vulva", "w00se", "wang", "wank", "wanker", "wanky", "whoar", "whore", "willies", "willy", "xrated", "xxx"]; 11 | 12 | export const _mainAutomodFunction = (message: Message) => { 13 | if (message.author.bot) return; 14 | if (!message.guild) return; 15 | if (!message.content) return; 16 | 17 | if (protectedRolesChecker(message.member, config.automod.protectedRoles)) return; 18 | 19 | const check_mute = async (warnreason?: string) => { 20 | const data = await client.db.automodInfraction.findMany({ 21 | where: { 22 | guildId: message.guildId, 23 | userId: message.author.id, 24 | } 25 | }); 26 | 27 | // If user has total of automod infractions higher or equal to 3, then this will be executed: 28 | if (data && data.length >= 3) { 29 | // Muting the user for 3 hours. 30 | await message.member.timeout(ms('3h'), warnreason).catch(() => { }); 31 | 32 | await message.channel.send({ 33 | embeds: [ 34 | embed(`${message.author.toString()} has been **auto-muted** with the ID: \`${message.id}\``, 'warn') 35 | ] 36 | }); 37 | 38 | await client.db.infraction.create({ 39 | data: { 40 | id: message.id, 41 | guildId: message.guildId, 42 | userId: message.author.id, 43 | moderatorId: client.user.id, 44 | expires: null, 45 | since: BigInt(Date.now()), 46 | type: 'Mute', 47 | reason: '[AutoMod] Reached over 3 infractions within 15 mins' 48 | } 49 | }); 50 | 51 | await client.db.automodInfraction.deleteMany({ 52 | where: { 53 | guildId: message.guildId, 54 | userId: message.author.id 55 | } 56 | }); 57 | 58 | return 1; 59 | }; 60 | 61 | return 0; 62 | }; 63 | 64 | const flag_message = async (msg: string, warnreason?: string) => { 65 | await message.delete().catch(() => { }); 66 | 67 | const res = await check_mute(warnreason); 68 | 69 | if (res === 1) return; 70 | 71 | // Adds a new infraction which expires after 6 hours. 72 | await client.db.automodInfraction.create({ 73 | data: { 74 | id: message.id, 75 | guildId: message.guildId, 76 | userId: message.author.id, 77 | expires: Date.now() + ms('6h'), 78 | since: Date.now(), 79 | reason: warnreason || 'No reason was provided' 80 | } 81 | }); 82 | 83 | await message.channel.send({ 84 | content: `${message.author.toString()}, ${msg}. Further infractions will be a punishment.` 85 | }).then(async (sent) => { 86 | await wait(5000); 87 | 88 | await sent.delete().catch(() => { }); 89 | }).catch(() => { }); 90 | }; 91 | 92 | if (swears.some((item) => message.content.split(' ').includes(item))) { 93 | flag_message('your message was flagged for swearing', '[AutoMod] Swearing or/and insulting'); 94 | 95 | return; 96 | }; 97 | 98 | if (ipRegex.test(message.content)) { 99 | flag_message('posting a real or fake IP is not allowed', '[AutoMod] Posting IP addresses'); 100 | 101 | return; 102 | }; 103 | 104 | let non_caps: number = 0; 105 | let caps: number = 0; 106 | 107 | for (let x = 0; x < message.content.length; x++) { 108 | if (!isNaN(parseInt(message.content[x]))) return; 109 | 110 | if (message.content[x].toUpperCase() === message.content[x]) { 111 | caps++; 112 | } else non_caps++; 113 | }; 114 | 115 | const textCaps = (caps / message.content.length) * 100; 116 | 117 | if (message.content.length > 15 && textCaps > 60) { 118 | flag_message('you are using too much caps (' + textCaps.toFixed(2) + '%)', '[AutoMod] Using too much capitalized letters'); 119 | 120 | return; 121 | }; 122 | 123 | if ((message?.mentions?.members?.size || 0) > 2) { 124 | flag_message('you are not allowed to mass mention pings', '[AutoMod] Mass mention'); 125 | 126 | return; 127 | }; 128 | 129 | const lineArray = message.content.match(/\n/g); 130 | const number = lineArray?.length || 0; 131 | 132 | if (number > 4) { 133 | flag_message('you cannot send a message with over 4 lines', '[AutoMod] Sending a message with over 4 lines'); 134 | 135 | return; 136 | }; 137 | 138 | if ((/discord(?:\.com|app\.com|\.gg)[\/invite\/]?(?:[a-zA-Z0-9\-]{2,32})/g).test(message.content)) { 139 | flag_message('you are not allowed to advertise on this server', '[AutoMod] Advertising a Discord server'); 140 | 141 | return; 142 | }; 143 | 144 | if ((/(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm).test(message.content)) { 145 | flag_message('you are not allowed to send links on this server', '[AutoMod] Sending website links'); 146 | 147 | return; 148 | }; 149 | 150 | const emojiRegex = message.content.match(/|\p{Extended_Pictographic}|/gu); 151 | 152 | if ((emojiRegex?.length || 0) > 5) { 153 | flag_message('you have used over 5 emojis in your message', '[AutoMod] Using too much emojis'); 154 | 155 | return; 156 | }; 157 | }; 158 | 159 | export default new Event('messageCreate', _mainAutomodFunction); 160 | -------------------------------------------------------------------------------- /src/commands/Administrator/custom-command.ts: -------------------------------------------------------------------------------- 1 | import { PermissionFlagsBits, REST, Routes, SlashCommandBuilder } from "discord.js"; 2 | import { Command } from "../../class/Builders"; 3 | import { embed } from "../../func"; 4 | 5 | export default new Command( 6 | new SlashCommandBuilder() 7 | .setName('cc') 8 | .setDescription('Custom commands system.') 9 | .addSubcommand((sub) => 10 | sub.setName('create') 11 | .setDescription('Create a new custom command.') 12 | .addStringOption((opt) => 13 | opt.setName('name') 14 | .setDescription('The name of the command.') 15 | .setMaxLength(32) 16 | .setMinLength(1) 17 | .setRequired(true) 18 | ) 19 | .addStringOption((opt) => 20 | opt.setName('description') 21 | .setDescription('The description of the command.') 22 | .setMaxLength(100) 23 | .setMinLength(1) 24 | .setRequired(true) 25 | ) 26 | .addStringOption((opt) => 27 | opt.setName('message') 28 | .setDescription('The message to say whenever the command is executed.') 29 | .setMaxLength(2000) 30 | .setMinLength(1) 31 | .setRequired(true) 32 | ) 33 | ) 34 | .addSubcommand((sub) => 35 | sub.setName('update') 36 | .setDescription('Update a custom command.') 37 | .addStringOption((opt) => 38 | opt.setName('name') 39 | .setDescription('The name of the command.') 40 | .setMaxLength(32) 41 | .setMinLength(1) 42 | .setRequired(true) 43 | ) 44 | .addStringOption((opt) => 45 | opt.setName('new-name') 46 | .setDescription('The new name of the command.') 47 | .setMaxLength(32) 48 | .setMinLength(1) 49 | .setRequired(false) 50 | ) 51 | .addStringOption((opt) => 52 | opt.setName('new-description') 53 | .setDescription('The new description of the command.') 54 | .setMaxLength(100) 55 | .setMinLength(1) 56 | .setRequired(false) 57 | ) 58 | .addStringOption((opt) => 59 | opt.setName('new-message') 60 | .setDescription('The new message to say whenever the command is executed.') 61 | .setMaxLength(2000) 62 | .setMinLength(1) 63 | .setRequired(false) 64 | ) 65 | ) 66 | .addSubcommand((sub) => 67 | sub.setName('delete') 68 | .setDescription('Delete a custom command.') 69 | .addStringOption((opt) => 70 | opt.setName('name') 71 | .setDescription('The name of the command.') 72 | .setMaxLength(32) 73 | .setMinLength(1) 74 | .setRequired(true) 75 | ) 76 | ) 77 | .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) 78 | .setDMPermission(false), 79 | async (client, interaction, db) => { 80 | 81 | await interaction.deferReply(); 82 | 83 | switch (interaction.options.getSubcommand()) { 84 | case 'create': { 85 | const name = interaction.options.getString('name', true).toLowerCase(); 86 | const description = interaction.options.getString('description', true); 87 | const message = interaction.options.getString('message', true); 88 | 89 | const count = await db.customCommand.count({ 90 | where: { 91 | guildId: interaction.guildId 92 | } 93 | }); 94 | 95 | if (count >= 5) { 96 | await interaction.followUp({ 97 | embeds: [ 98 | embed(`You can only created **5** custom commands per guild!`, 'error') 99 | ] 100 | }); 101 | 102 | return; 103 | }; 104 | 105 | const secondcount = await db.customCommand.count({ 106 | where: { 107 | guildId: interaction.guildId, 108 | name: name 109 | } 110 | }); 111 | 112 | if (secondcount >= 1) { 113 | await interaction.followUp({ 114 | embeds: [ 115 | embed(`This command name has been registered already!`, 'error') 116 | ] 117 | }); 118 | 119 | return; 120 | }; 121 | 122 | if (client.commands.has(name)) { 123 | await interaction.followUp({ 124 | embeds: [ 125 | embed(`This is a default application command name, you can't do that!`, 'error') 126 | ] 127 | }); 128 | 129 | return; 130 | }; 131 | 132 | await interaction.followUp({ 133 | embeds: [ 134 | embed('Creating a new command... Please wait!', 'loading', 'This might take up to 3 minutes!') 135 | ] 136 | }); 137 | 138 | try { 139 | const rest = new REST().setToken(process.env.CLIENT_TOKEN); 140 | 141 | await db.customCommand.create({ 142 | data: { 143 | guildId: interaction.guildId, 144 | name: name, 145 | description: description, 146 | content: message 147 | } 148 | }); 149 | 150 | const data = await db.customCommand.findMany({ 151 | where: { 152 | guildId: interaction.guildId 153 | } 154 | }); 155 | 156 | const commands = []; 157 | 158 | for (const command of data) { 159 | commands.push( 160 | new SlashCommandBuilder() 161 | .setName(command.name) 162 | .setDescription(command.description) 163 | .setDMPermission(false) 164 | ) 165 | }; 166 | 167 | await rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID, interaction.guildId), { 168 | body: commands 169 | }); 170 | 171 | await interaction.editReply({ 172 | embeds: [ 173 | embed(`The custom command **${name}** has been successfully created and registered!`, 'info') 174 | ] 175 | }); 176 | } catch { 177 | await interaction.editReply({ 178 | embeds: [ 179 | embed(`Unable to register the command, please try again later.`, 'error') 180 | ] 181 | }); 182 | }; 183 | 184 | break; 185 | }; 186 | 187 | case 'update': { 188 | const name = interaction.options.getString('name', true); 189 | 190 | const newname = interaction.options.getString('new-name')?.toLowerCase(); 191 | const newdescription = interaction.options.getString('new-description'); 192 | const newmessage = interaction.options.getString('new-message'); 193 | 194 | const count = await db.customCommand.count({ 195 | where: { 196 | guildId: interaction.guildId, 197 | name: name 198 | } 199 | }); 200 | 201 | if (count <= 0) { 202 | await interaction.followUp({ 203 | embeds: [ 204 | embed(`No command was found with the name **${name}**.`, 'error') 205 | ] 206 | }); 207 | 208 | return; 209 | }; 210 | 211 | if (!newname && !newdescription && !newmessage) { 212 | await interaction.followUp({ 213 | embeds: [ 214 | embed('You need at least update something for the command; Name, description, or message!', 'error') 215 | ] 216 | }); 217 | 218 | return; 219 | }; 220 | 221 | const secondcount = await db.customCommand.count({ 222 | where: { 223 | guildId: interaction.guildId, 224 | name: newname 225 | } 226 | }); 227 | 228 | if (secondcount >= 1) { 229 | await interaction.followUp({ 230 | embeds: [ 231 | embed(`This new command name has been registered already!`, 'error') 232 | ] 233 | }); 234 | 235 | return; 236 | }; 237 | 238 | await interaction.followUp({ 239 | embeds: [ 240 | embed('Updating the command... Please wait!', 'loading', 'This might take up to 3 minutes!') 241 | ] 242 | }); 243 | 244 | try { 245 | const rest = new REST().setToken(process.env.CLIENT_TOKEN); 246 | 247 | const olddata = (await db.customCommand.findMany({ 248 | where: { 249 | guildId: interaction.guildId, 250 | name: name 251 | } 252 | }))[0]; 253 | 254 | await db.customCommand.updateMany({ 255 | where: { 256 | guildId: interaction.guildId, 257 | name: name 258 | }, 259 | data: { 260 | name: newname || name, 261 | description: newdescription || olddata.description, 262 | content: newmessage || olddata.content 263 | } 264 | }); 265 | 266 | const data = await db.customCommand.findMany({ 267 | where: { 268 | guildId: interaction.guildId 269 | } 270 | }); 271 | 272 | const commands = []; 273 | 274 | for (const command of data) { 275 | commands.push( 276 | new SlashCommandBuilder() 277 | .setName(command.name) 278 | .setDescription(command.description) 279 | .setDMPermission(false) 280 | ) 281 | }; 282 | 283 | await rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID, interaction.guildId), { 284 | body: commands 285 | }); 286 | 287 | await interaction.editReply({ 288 | embeds: [ 289 | embed(`The custom command **${newname || name}** has been updated!`, 'info') 290 | ] 291 | }); 292 | } catch { 293 | await interaction.editReply({ 294 | embeds: [ 295 | embed(`Unable to register the commands, please try again later.`, 'error') 296 | ] 297 | }); 298 | }; 299 | 300 | break; 301 | }; 302 | 303 | case 'delete': { 304 | const name = interaction.options.getString('name', true).toLowerCase(); 305 | 306 | const count = await db.customCommand.count({ 307 | where: { 308 | guildId: interaction.guildId, 309 | name: name 310 | } 311 | }); 312 | 313 | if (count <= 0) { 314 | await interaction.followUp({ 315 | embeds: [ 316 | embed(`No command was found with the name **${name}**.`, 'error') 317 | ] 318 | }); 319 | 320 | return; 321 | }; 322 | 323 | await interaction.followUp({ 324 | embeds: [ 325 | embed('Deleting the command... Please wait!', 'loading', 'This might take up to 3 minutes!') 326 | ] 327 | }); 328 | 329 | try { 330 | const rest = new REST().setToken(process.env.CLIENT_TOKEN); 331 | 332 | await db.customCommand.deleteMany({ 333 | where: { 334 | guildId: interaction.guildId, 335 | name: name 336 | } 337 | }); 338 | 339 | const data = await db.customCommand.findMany({ 340 | where: { 341 | guildId: interaction.guildId 342 | } 343 | }); 344 | 345 | const commands = []; 346 | 347 | for (const command of data) { 348 | commands.push( 349 | new SlashCommandBuilder() 350 | .setName(command.name) 351 | .setDescription(command.description) 352 | .setDMPermission(false) 353 | ) 354 | }; 355 | await rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID, interaction.guildId), { 356 | body: commands 357 | }); 358 | 359 | await interaction.editReply({ 360 | embeds: [ 361 | embed(`The custom command **${name}** has been deleted!`, 'info') 362 | ] 363 | }); 364 | } catch { 365 | await interaction.editReply({ 366 | embeds: [ 367 | embed(`Unable to register the commands, please try again later.`, 'error') 368 | ] 369 | }); 370 | }; 371 | 372 | break; 373 | }; 374 | }; 375 | 376 | } 377 | ); 378 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 2023 TFAGaming 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------