Skip to content

Commit

Permalink
feat: Rule module
Browse files Browse the repository at this point in the history
  • Loading branch information
scmcgowen committed Aug 7, 2024
1 parent ddda811 commit 486af7c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Module } from "./Module.js";

// codegen:start {preset: custom, source: ../tools/codegen-module-index.cjs, export: moduleCodegen}
/// This file is generated by tools/codegen-module-index.cjs. Run `pnpm lint:codegen` to update it.
// This file is generated by tools/codegen-module-index.cjs. Run `pnpm lint:codegen` to update it.
import Example from "./modules/Example.js";
import ForumPinner from "./modules/ForumPinner.js";
import Info from "./modules/Info.js";
import Ping from "./modules/Ping.js";
import Rules from "./modules/Rules.js";
import System from "./modules/System.js";
const modules = {
Example,
ForumPinner,
Info,
Ping,
Rules,
System,
} as const satisfies Record<string, typeof Module>;
// codegen:end
Expand Down
38 changes: 38 additions & 0 deletions src/modules/Rules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { SlashCommandBuilder } from "discord.js";
import { Module } from "../Module.js";

const rules: string[] = [
"1. Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.",
"2. No spam, excessive swearing or any other behaviour intended to cause annoyance or irritation amongst others.",
"3. No NSFW or obscene content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.",
"4. If you see something that makes you feel unsafe, let staff know by ping or direct message. We want this server to be a welcoming space!",
"5. Your (server-)username should be something that is both pronounceable and typeable using an (US)-International keyboard without modifier keys.",
"6. Have a good time and let us know how we can improve!",
"7. Do not feed trolls or fuel bullying, harassment or other unwanted behaviour. Stop participating in the conversation and report to staff.",
];

export default class Rules extends Module {
name = "Ping";
description = "This module allows users to ping the bot and receive a reply.";

async start() {
this.bot.registerCommand({
data: new SlashCommandBuilder()
.setName("rule")
.setDescription("Replies with the selected rule")
.addIntegerOption((option) =>
option
.setName("rule")
.setDescription("Select a rule")
.setRequired(true)
.setMinValue(1)
.setMaxValue(7)
),
async execute(interaction) {
const rule = interaction.options.getInteger("rule");

await interaction.reply({ content: `Rule ${rules[rule - 1]}` });
},
});
}
}

0 comments on commit 486af7c

Please sign in to comment.