-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from tannnxr/dev
Changed a shit ton, I honestly don't even know what to explain here. look at commits.
- Loading branch information
Showing
13 changed files
with
168 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
This file contains 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
This file contains 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,31 @@ | ||
# Shork Utilities | ||
|
||
Shork makes use of several utility files to make some parts of development easier. They can be found in the ../src/utils/ directory. | ||
|
||
|
||
## Channel (TS) | ||
|
||
The `getChannel` function is used to get a text channel within the guild. It returns a Discord.js type of TextChannel. | ||
|
||
```ts | ||
getChannel(): TextChannel | ||
``` | ||
|
||
## Commands (TS) (SINGLETON) | ||
|
||
The `getCommandFiles` function is used to get all the command files within the /commands/ directory. | ||
Due to the fact that it makes use of a redis cache this should only be used ONCE. All other needs to access command files should be done by grabbing from the Redis cache | ||
|
||
```ts | ||
async getCommandFiles() | ||
``` | ||
|
||
## Files (TS) | ||
|
||
The `getFilesRecursively` function should be used to get all the files of a specific directory. You shouldn't need to use this unless you're improving it or trying to get files from a directory (obviously) | ||
|
||
TODO: Make this more efficient or something. | ||
|
||
```ts | ||
getFilesRecursively() | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,23 +1,33 @@ | ||
import { ChatInputCommandInteraction, PermissionFlagsBits, SlashCommandBuilder, SlashCommandMentionableOption, SlashCommandStringOption } from "discord.js"; | ||
import { | ||
ChatInputCommandInteraction, | ||
PermissionFlagsBits, | ||
SlashCommandBuilder, | ||
SlashCommandMentionableOption, | ||
SlashCommandStringOption, | ||
} from "discord.js"; | ||
import { LogType, Logger } from "../../utils/logging"; | ||
|
||
export default { | ||
data: new SlashCommandBuilder() | ||
.setName('warn') | ||
.setDescription('Warn a user.') | ||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels) | ||
.addMentionableOption(option => | ||
option.setName('user') | ||
.setDescription('The user to warn.') | ||
.setRequired(true)) | ||
.addStringOption(option => | ||
option.setName('reason') | ||
.setDescription('The reason you\'re warning the user for') | ||
.setRequired(false)), | ||
data: new SlashCommandBuilder() | ||
.setName("warn") | ||
.setDescription("Warn a user.") | ||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels) | ||
.addMentionableOption((option) => | ||
option | ||
.setName("user") | ||
.setDescription("The user to warn.") | ||
.setRequired(true) | ||
) | ||
.addStringOption((option) => | ||
option | ||
.setName("reason") | ||
.setDescription("The reason you're warning the user for") | ||
.setRequired(false) | ||
), | ||
|
||
async execute(interaction: ChatInputCommandInteraction) { | ||
const logger = new Logger(__filename, LogType.DEBUG) | ||
async execute(interaction: ChatInputCommandInteraction) { | ||
const logger = new Logger(__filename, LogType.DEBUG); | ||
|
||
logger.log('warn command') | ||
} | ||
} | ||
logger.log("warn command"); | ||
}, | ||
}; |
This file contains 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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import { BaseInteraction, Events, InteractionType, TextChannel } from "discord.js"; | ||
import { | ||
BaseInteraction, | ||
Events, | ||
InteractionType, | ||
TextChannel, | ||
} from "discord.js"; | ||
import { Shork } from "../../Shork"; | ||
import { getChannel } from "../../utils/channel"; | ||
import { shorkCache } from "../../db/cache"; | ||
import { CommandReferenceType } from "../../registerCommands"; | ||
|
||
import { getCommandFiles } from "../../utils/commands"; | ||
|
||
export default { | ||
name: Events.InteractionCreate, | ||
execute: async (interaction: BaseInteraction) => { | ||
if (interaction.type == InteractionType.ApplicationCommand) { | ||
const redisCmdFiles = await shorkCache.get('commandFiles') | ||
if (!redisCmdFiles) { | ||
getCommandFiles() | ||
} | ||
|
||
} | ||
name: Events.InteractionCreate, | ||
execute: async (interaction: BaseInteraction) => { | ||
const client = interaction.client as Shork; | ||
if (interaction.type == InteractionType.ApplicationCommand) { | ||
} | ||
} | ||
}, | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,15 @@ | ||
import { ClientOptions, REST } from "discord.js"; | ||
|
||
/** | ||
* A mock client used for testing, derived from the official Client class from discord.js | ||
* @extends {null} | ||
*/ | ||
class MockClient { | ||
rest: REST; | ||
constructor(options: ClientOptions) { | ||
// Rest manager of the MockClient | ||
this.rest = new REST() | ||
} | ||
} | ||
|
||
export {MockClient} |
This file contains 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