Compare commits
4 commits
c36b2fa7d8
...
3a38fbf7fc
Author | SHA1 | Date | |
---|---|---|---|
3a38fbf7fc | |||
64649743e7 | |||
5a31c3cf74 | |||
00bd7d4ff5 |
12 changed files with 109 additions and 182 deletions
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
16
.github/ISSUE_TEMPLATE/epic.md
vendored
16
.github/ISSUE_TEMPLATE/epic.md
vendored
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
name: Epic
|
||||
about: Agile Epic
|
||||
title: ''
|
||||
labels: epic
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
*Description here*
|
||||
|
||||
## Stories
|
||||
*Stories linked to this epic*
|
||||
|
||||
## Bugs
|
||||
*Bugs linked to this epic*
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
24
.github/ISSUE_TEMPLATE/user-story.md
vendored
24
.github/ISSUE_TEMPLATE/user-story.md
vendored
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
name: User Story
|
||||
about: Agile User Story
|
||||
title: ''
|
||||
labels: needs criteria, story
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Epic Link: N/A
|
||||
Story Points: N/A
|
||||
|
||||
---
|
||||
|
||||
*Description here*
|
||||
|
||||
## Acceptance Criteria
|
||||
*Add your ACs here*
|
||||
|
||||
## Notes
|
||||
*Any extra information*
|
||||
|
||||
## Subtasks
|
||||
*Add technical subtasks here*
|
30
.github/pull_request_template.md
vendored
30
.github/pull_request_template.md
vendored
|
@ -1,30 +0,0 @@
|
|||
# Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
# How Has This Been Tested?
|
||||
|
||||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
||||
|
||||
|
||||
# Checklist:
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
- [ ] Any dependent changes have been merged and published in downstream modules
|
|
@ -1,29 +0,0 @@
|
|||
# Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- Bug fix (non-breaking change which fixes an issue)
|
||||
- New feature (non-breaking change which adds functionality)
|
||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- This change requires a documentation update
|
||||
|
||||
# How Has This Been Tested?
|
||||
|
||||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
||||
|
||||
# Checklist
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
- [ ] Any dependant changes have been merged and published in downstream modules
|
|
@ -39,6 +39,9 @@
|
|||
"ts-jest": "^29.0.0",
|
||||
"typeorm": "0.3.17"
|
||||
},
|
||||
"resolutions": {
|
||||
"**/semver": "^7.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"typescript": "^5.0.0"
|
||||
|
|
91
src/commands/poll.ts
Normal file
91
src/commands/poll.ts
Normal file
|
@ -0,0 +1,91 @@
|
|||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import { Command } from "../type/command";
|
||||
import { EmbedBuilder } from "@discordjs/builders";
|
||||
import EmbedColours from "../constants/EmbedColours";
|
||||
|
||||
export default class Poll extends Command {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
super.CommandBuilder = new SlashCommandBuilder()
|
||||
.setName('poll')
|
||||
.setDescription('Run a poll, automatically adding reaction emojis as options')
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('title')
|
||||
.setDescription('Title of the poll')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('option1')
|
||||
.setDescription('Option 1')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('option2')
|
||||
.setDescription('Option 2')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('option3')
|
||||
.setDescription('Option 3'))
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('option4')
|
||||
.setDescription('Option 4'))
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('option5')
|
||||
.setDescription('Option 5'));
|
||||
}
|
||||
|
||||
public override async execute(interaction: CommandInteraction) {
|
||||
const title = interaction.options.get('title');
|
||||
const option1 = interaction.options.get('option1');
|
||||
const option2 = interaction.options.get('option2');
|
||||
const option3 = interaction.options.get('option3');
|
||||
const option4 = interaction.options.get('option4');
|
||||
const option5 = interaction.options.get('option5');
|
||||
|
||||
if (!title || !option1 || !option2) return;
|
||||
|
||||
const description = [
|
||||
option1.value as string,
|
||||
option2.value as string,
|
||||
option3?.value as string,
|
||||
option4?.value as string,
|
||||
option5?.value as string
|
||||
]
|
||||
.filter(x => x != null);
|
||||
|
||||
const arrayOfNumbers = [
|
||||
':one:',
|
||||
':two:',
|
||||
':three:',
|
||||
':four:',
|
||||
':five:',
|
||||
];
|
||||
|
||||
const reactionEmojis = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣"];
|
||||
|
||||
description.forEach((value, index) => {
|
||||
description[index] = `${reactionEmojis[index]} ${description[index]}`;
|
||||
});
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(EmbedColours.Ok)
|
||||
.setTitle(title.value as string)
|
||||
.setDescription(description.join('\n'))
|
||||
.setFooter({
|
||||
text: `Poll by ${interaction.user.username}`,
|
||||
iconURL: interaction.user.avatarURL()!,
|
||||
});
|
||||
|
||||
|
||||
const message = await interaction.reply({ embeds: [ embed ]});
|
||||
|
||||
description.forEach(async (value, index) => {
|
||||
await (await message.fetch()).react(reactionEmojis[index]);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import Disable from "./commands/disable";
|
|||
import Ignore from "./commands/ignore";
|
||||
import Kick from "./commands/kick";
|
||||
import Mute from "./commands/mute";
|
||||
import Poll from "./commands/poll";
|
||||
import Role from "./commands/Role/role";
|
||||
import ConfigRole from "./commands/Role/config";
|
||||
import Rules from "./commands/rules";
|
||||
|
@ -49,6 +50,7 @@ export default class Registry {
|
|||
CoreClient.RegisterCommand("ignore", new Ignore());
|
||||
CoreClient.RegisterCommand("kick", new Kick());
|
||||
CoreClient.RegisterCommand("mute", new Mute());
|
||||
CoreClient.RegisterCommand("poll", new Poll());
|
||||
CoreClient.RegisterCommand("rules", new Rules());
|
||||
CoreClient.RegisterCommand("setup", new Setup());
|
||||
CoreClient.RegisterCommand("timeout", new Timeout());
|
||||
|
|
38
yarn.lock
38
yarn.lock
|
@ -751,9 +751,9 @@
|
|||
pretty-format "^29.0.0"
|
||||
|
||||
"@types/node@*":
|
||||
version "20.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.1.0.tgz#258805edc37c327cf706e64c6957f241ca4c4c20"
|
||||
integrity sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==
|
||||
version "20.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.2.tgz#129cc9ae69f93824f92fac653eebfb4812ab4af9"
|
||||
integrity sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==
|
||||
|
||||
"@types/node@^20.0.0":
|
||||
version "20.1.4"
|
||||
|
@ -2076,9 +2076,9 @@ lines-and-columns@^1.1.6:
|
|||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||
|
||||
linqts@^1.14.4:
|
||||
version "1.14.4"
|
||||
resolved "https://registry.yarnpkg.com/linqts/-/linqts-1.14.4.tgz#0aa0f78fc6be073d7db874e0a0480fda5d06db7d"
|
||||
integrity sha512-b5sJjG1ZQ8iLSTJV19jWgMLoQicrQVVRkkQN7B/aboU+cf30lgnhIoGM8vEjqPxZFpryDU78PFpuTnfYNIHMeg==
|
||||
version "1.15.0"
|
||||
resolved "https://registry.yarnpkg.com/linqts/-/linqts-1.15.0.tgz#99195db380da7c039961c00e637e6ae57d5dee5e"
|
||||
integrity sha512-DYRi1eGy8R0/dPzTTE0q3gQKvAj960CumYNikVGaUBc8TJCs/zeIbEmHb9lGx7Y9ALvTKle2cuBpkKgIeCSRTg==
|
||||
|
||||
locate-path@^5.0.0:
|
||||
version "5.0.0"
|
||||
|
@ -2415,9 +2415,9 @@ quick-lru@^5.1.1:
|
|||
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
|
||||
|
||||
random-bunny@^2.0.5:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.0.tgz#ddabec169b0dc2207a67eeed454cf19f87b4de48"
|
||||
integrity sha512-NtPS4Ltqh2mdVddUeDCzP+lgbx5XAxwyq04BSRuchFDRycWVO9XqO2NEEim/rYYu7iA99v7I5B3/VUZb1NiE0g==
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/random-bunny/-/random-bunny-2.1.3.tgz#690cd260730409687eb3f1a72064c75f3acdb5f5"
|
||||
integrity sha512-j6dxMmKZsiEfQrDn3ZJo4/lTOk+mdV5JVug9hCYQ0BGAucNn3vi/R2NEShOQe8O/501qNSnzrAtVn6fIc6i88Q==
|
||||
dependencies:
|
||||
glob-parent "^6.0.0"
|
||||
got-cjs "^12.5.4"
|
||||
|
@ -2520,22 +2520,10 @@ safe-buffer@^5.0.1, safe-buffer@~5.2.0:
|
|||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||
|
||||
semver@7.x:
|
||||
version "7.5.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.0.tgz#ed8c5dc8efb6c629c88b23d41dc9bf40c1d96cd0"
|
||||
integrity sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^6.0.0, semver@^6.3.0:
|
||||
version "6.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
|
||||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
|
||||
|
||||
semver@^7.3.5:
|
||||
version "7.3.8"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
|
||||
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
|
||||
semver@7.x, semver@^6.0.0, semver@^6.3.0, semver@^7.3.5, semver@^7.5.2:
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
|
|
Loading…
Reference in a new issue