-
Notifications
You must be signed in to change notification settings - Fork 51
Staff management System #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Kevinking500
wants to merge
25
commits into
ScootKit:main
Choose a base branch
from
Kevinking500:staff-management-system
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a14bcea
update to discord.js v14
SCDerox bcf08e6
fixed missing strings
SCDerox cea21e1
fixed broken info-commands
SCDerox 0095066
fixed duplicated entry
SCDerox 1746bcc
Adds ping-protection module. (#168)
Kevinking500 de23ed2
Ping Protection V1.1 (#171)
Kevinking500 acf8bf7
bumped changes
SCDerox f0f4bc5
feat(economy): implements "Artikel bearbeiten" (#179)
jateute e72ed64
Added name-list-cleaner AGAIN (#183)
hfgd123 29addb8
Staff Management System
22740b7
Staff Management V1, adjusted to what Copilot requested
d569f1e
Fixed some changes and rewrote botReady to be better
55d4199
New changes from feedback.
bc62741
New changes from feedback, and removed many unused locales keys
217dc78
Some changes
e85a4b9
Made changes according to feedbacks, bugs and more. Also includes som…
971cdce
Updated according to feedbacks
e33fd70
Changed some lines of code according to feedback and self-testing
6d272e9
Some minor changes
9f7c41d
Some parameters fixes and adjustments
d88af1e
Quick config image fix
d14c9bc
Added deferReply for multiple functions to avoid Discord timeouts in …
3f0d0c5
Added deferReply to 3 more functions
6aa556c
Applied fixes
1e22522
Quick fix regarding defer reply
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
717 changes: 717 additions & 0 deletions
717
modules/staff-management-system/commands/staff-management.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| const { MessageFlags } = require('discord.js'); | ||
| const { handleStatusRequest, handleStatusView, handleStatusList, handleStatusManage } = require('../staff-management'); | ||
| const { localize } = require('../../../src/functions/localize'); | ||
|
|
||
| module.exports.beforeSubcommand = async function (interaction) { | ||
| if (!interaction.replied && !interaction.deferred) { | ||
| await interaction.deferReply({ | ||
| flags: MessageFlags.Ephemeral | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| module.exports.subcommands = { | ||
| 'loa': { | ||
| 'request': async function (interaction) { | ||
| const duration = interaction.options.getString('duration'); | ||
| const reason = interaction.options.getString('reason'); | ||
| await handleStatusRequest(interaction.client, interaction, 'LOA', duration, reason); | ||
| }, | ||
| 'view': async function (interaction) { | ||
| const user = interaction.options.getUser('user') || interaction.user; | ||
| await handleStatusView(interaction.client, interaction, 'LOA', user); | ||
| }, | ||
| 'list': async function (interaction) { | ||
| const filter = interaction.options.getString('filter'); | ||
| await handleStatusList(interaction.client, interaction, 'LOA', filter); | ||
| }, | ||
| 'admin': async function (interaction) { | ||
| const user = interaction.options.getMember('user'); | ||
| if (!user) return interaction.editReply({ | ||
| content: localize('staff-management-system', 'err-no-mem') | ||
| }); | ||
| await handleStatusManage(interaction.client, interaction, user, 'LOA'); | ||
| } | ||
| }, | ||
| 'ra': { | ||
| 'request': async function (interaction) { | ||
| const duration = interaction.options.getString('duration'); | ||
| const reason = interaction.options.getString('reason'); | ||
| await handleStatusRequest(interaction.client, interaction, 'RA', duration, reason); | ||
| }, | ||
| 'view': async function (interaction) { | ||
| const user = interaction.options.getUser('user') || interaction.user; | ||
| await handleStatusView(interaction.client, interaction, 'RA', user); | ||
| }, | ||
| 'list': async function (interaction) { | ||
| const filter = interaction.options.getString('filter'); | ||
| await handleStatusList(interaction.client, interaction, 'RA', filter); | ||
| }, | ||
| 'admin': async function (interaction) { | ||
| const user = interaction.options.getMember('user'); | ||
| if (!user) return interaction.editReply({ | ||
| content: localize('staff-management-system', 'err-no-mem') | ||
| }); | ||
| await handleStatusManage(interaction.client, interaction, user, 'RA'); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| module.exports.config = { | ||
| name: 'status', | ||
| description: localize('staff-management-system', 'cmd-desc-status'), | ||
| usage: '/status', | ||
| type: 'slash', | ||
| defaultPermission: false, | ||
| options: [ | ||
| { | ||
| type: 'SUB_COMMAND_GROUP', | ||
| name: 'loa', | ||
| description: localize('staff-management-system', 'cmd-desc-loa'), | ||
| options: [ | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'request', | ||
| description: localize('staff-management-system', 'cmd-desc-loa-request'), | ||
| options: [ | ||
| { | ||
| type: 'STRING', | ||
| name: 'duration', | ||
| description: localize('staff-management-system', 'cmd-desc-loar-duration'), | ||
| required: true | ||
| }, | ||
| { | ||
| type: 'STRING', | ||
| name: 'reason', | ||
| description: localize('staff-management-system', 'cmd-desc-loar-reason'), | ||
| required: true | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'view', | ||
| description: localize('staff-management-system', 'cmd-desc-loa-view'), | ||
| options: [ | ||
| { | ||
| type: 'USER', | ||
| name: 'user', | ||
| description: localize('staff-management-system', 'cmd-desc-loav-user'), | ||
| required: false | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'list', | ||
| description: localize('staff-management-system', 'cmd-desc-loa-list'), | ||
| options: [{ | ||
| type: 'STRING', | ||
| name: 'filter', | ||
| description: localize('staff-management-system', 'cmd-desc-loal-filter'), | ||
| required: true, | ||
| choices: [ | ||
| { | ||
| name: 'Active', | ||
| value: 'active' | ||
| }, | ||
| { | ||
| name: 'Expired', | ||
| value: 'expired' | ||
| }, | ||
| { | ||
| name: 'All', | ||
| value: 'all' | ||
| }] | ||
| }] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'admin', | ||
| description: localize('staff-management-system', 'cmd-desc-loa-admin'), | ||
| options: [ | ||
| { | ||
| type: 'USER', | ||
| name: 'user', | ||
| description: localize('staff-management-system', 'cmd-desc-loaa-user'), | ||
| required: true | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND_GROUP', | ||
| name: 'ra', | ||
| description: localize('staff-management-system', 'cmd-desc-ra'), | ||
| options: [ | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'request', | ||
| description: localize('staff-management-system', 'cmd-desc-ra-request'), | ||
| options: [ | ||
| { | ||
| type: 'STRING', | ||
| name: 'duration', | ||
| description: localize('staff-management-system', 'cmd-desc-rar-duration'), | ||
| required: true | ||
| }, | ||
| { | ||
| type: 'STRING', | ||
| name: 'reason', | ||
| description: localize('staff-management-system', 'cmd-desc-rar-reason'), | ||
| required: true | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'view', | ||
| description: localize('staff-management-system', 'cmd-desc-ra-view'), | ||
| options: [ | ||
| { | ||
| type: 'USER', | ||
| name: 'user', | ||
| description: localize('staff-management-system', 'cmd-desc-rav-user'), | ||
| required: false | ||
| }] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'list', | ||
| description: localize('staff-management-system', 'cmd-desc-ra-list'), | ||
| options: [ | ||
| { | ||
| type: 'STRING', | ||
| name: 'filter', | ||
| description: localize('staff-management-system', 'cmd-desc-ral-filter'), | ||
| required: true, | ||
| choices: [ | ||
| { | ||
| name: 'Active', | ||
| value: 'active' | ||
| }, | ||
| { | ||
| name: 'Expired', | ||
| value: 'expired' | ||
| }, | ||
| { | ||
| name: 'All', | ||
| value: 'all' | ||
| } | ||
| ] | ||
| }] | ||
| }, | ||
| { | ||
| type: 'SUB_COMMAND', | ||
| name: 'admin', | ||
| description: localize('staff-management-system', 'cmd-desc-ra-admin'), | ||
| options: [ | ||
| { | ||
| type: 'USER', | ||
| name: 'user', | ||
| description: localize('staff-management-system', 'cmd-desc-raa-user'), | ||
| required: true | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.