create-reciple 9.12.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -59
- package/LICENSE +0 -674
- package/README.md +0 -44
- package/assets/README.md +0 -29
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -58
- package/dist/bin.js.map +0 -1
- package/dist/classes/Addon.d.ts +0 -68
- package/dist/classes/Addon.js +0 -111
- package/dist/classes/Addon.js.map +0 -1
- package/dist/classes/Config.d.ts +0 -31
- package/dist/classes/Config.js +0 -61
- package/dist/classes/Config.js.map +0 -1
- package/dist/classes/Setup.d.ts +0 -43
- package/dist/classes/Setup.js +0 -149
- package/dist/classes/Setup.js.map +0 -1
- package/dist/classes/TemplateBuilder.d.ts +0 -94
- package/dist/classes/TemplateBuilder.js +0 -244
- package/dist/classes/TemplateBuilder.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/utils/constants.d.ts +0 -13
- package/dist/utils/constants.js +0 -75
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/helpers.d.ts +0 -32
- package/dist/utils/helpers.js +0 -88
- package/dist/utils/helpers.js.map +0 -1
- package/dist/utils/types.d.ts +0 -20
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.js.map +0 -1
- package/templates/javascript/dot.gitignore +0 -130
- package/templates/javascript/modules/commands/PingCommand.js +0 -68
- package/templates/javascript/modules/events/WelcomeEvent.js +0 -54
- package/templates/javascript/modules/halts/CommandErrorHalt.js +0 -59
- package/templates/javascript/modules/preconditions/ExamplePrecondition.js +0 -27
- package/templates/javascript/nodemon.json +0 -16
- package/templates/javascript/package.json +0 -18
- package/templates/javascript/template.json +0 -4
- package/templates/typescript/dot.gitignore +0 -133
- package/templates/typescript/nodemon.json +0 -17
- package/templates/typescript/package.json +0 -21
- package/templates/typescript/src/commands/PingCommand.ts +0 -52
- package/templates/typescript/src/events/WelcomeEvent.ts +0 -39
- package/templates/typescript/src/halts/CommandErrorHalt.ts +0 -44
- package/templates/typescript/src/preconditions/ExamplePrecondition.ts +0 -18
- package/templates/typescript/template.json +0 -4
- package/templates/typescript/tsconfig.json +0 -19
- package/templates/typescript-decorators/dot.gitignore +0 -133
- package/templates/typescript-decorators/nodemon.json +0 -17
- package/templates/typescript-decorators/package.json +0 -22
- package/templates/typescript-decorators/src/commands/PingCommand.ts +0 -45
- package/templates/typescript-decorators/src/events/WelcomeEvent.ts +0 -37
- package/templates/typescript-decorators/src/halts/CommandErrorHalt.ts +0 -44
- package/templates/typescript-decorators/src/preconditions/ExamplePrecondition.ts +0 -18
- package/templates/typescript-decorators/template.json +0 -4
- package/templates/typescript-decorators/tsconfig.json +0 -19
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
lerna-debug.log*
|
|
8
|
-
.pnpm-debug.log*
|
|
9
|
-
|
|
10
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
-
|
|
13
|
-
# Runtime data
|
|
14
|
-
pids
|
|
15
|
-
*.pid
|
|
16
|
-
*.seed
|
|
17
|
-
*.pid.lock
|
|
18
|
-
|
|
19
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
20
|
-
lib-cov
|
|
21
|
-
|
|
22
|
-
# Docs files
|
|
23
|
-
docs.json
|
|
24
|
-
|
|
25
|
-
# Coverage directory used by tools like istanbul
|
|
26
|
-
coverage
|
|
27
|
-
*.lcov
|
|
28
|
-
|
|
29
|
-
# nyc test coverage
|
|
30
|
-
.nyc_output
|
|
31
|
-
|
|
32
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
33
|
-
.grunt
|
|
34
|
-
|
|
35
|
-
# Bower dependency directory (https://bower.io/)
|
|
36
|
-
bower_components
|
|
37
|
-
|
|
38
|
-
# node-waf configuration
|
|
39
|
-
.lock-wscript
|
|
40
|
-
|
|
41
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
42
|
-
build/Release
|
|
43
|
-
|
|
44
|
-
# Dependency directories
|
|
45
|
-
node_modules/
|
|
46
|
-
jspm_packages/
|
|
47
|
-
|
|
48
|
-
# Snowpack dependency directory (https://snowpack.dev/)
|
|
49
|
-
web_modules/
|
|
50
|
-
|
|
51
|
-
# TypeScript cache
|
|
52
|
-
*.tsbuildinfo
|
|
53
|
-
|
|
54
|
-
# Optional npm cache directory
|
|
55
|
-
.npm
|
|
56
|
-
|
|
57
|
-
# Optional eslint cache
|
|
58
|
-
.eslintcache
|
|
59
|
-
|
|
60
|
-
# Optional stylelint cache
|
|
61
|
-
.stylelintcache
|
|
62
|
-
|
|
63
|
-
# Microbundle cache
|
|
64
|
-
.rpt2_cache/
|
|
65
|
-
.rts2_cache_cjs/
|
|
66
|
-
.rts2_cache_es/
|
|
67
|
-
.rts2_cache_umd/
|
|
68
|
-
|
|
69
|
-
# Optional REPL history
|
|
70
|
-
.node_repl_history
|
|
71
|
-
|
|
72
|
-
# Output of 'npm pack'
|
|
73
|
-
*.tgz
|
|
74
|
-
|
|
75
|
-
# Yarn Integrity file
|
|
76
|
-
.yarn-integrity
|
|
77
|
-
|
|
78
|
-
# dotenv environment variable files
|
|
79
|
-
.env
|
|
80
|
-
.env.development.local
|
|
81
|
-
.env.test.local
|
|
82
|
-
.env.production.local
|
|
83
|
-
.env.local
|
|
84
|
-
|
|
85
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
86
|
-
.cache
|
|
87
|
-
.parcel-cache
|
|
88
|
-
|
|
89
|
-
# Next.js build output
|
|
90
|
-
.next
|
|
91
|
-
out
|
|
92
|
-
|
|
93
|
-
# Nuxt.js build / generate output
|
|
94
|
-
.nuxt
|
|
95
|
-
dist
|
|
96
|
-
|
|
97
|
-
# Gatsby files
|
|
98
|
-
.cache/
|
|
99
|
-
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
100
|
-
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
101
|
-
# public
|
|
102
|
-
|
|
103
|
-
# vuepress build output
|
|
104
|
-
.vuepress/dist
|
|
105
|
-
|
|
106
|
-
# vuepress v2.x temp and cache directory
|
|
107
|
-
.temp
|
|
108
|
-
.cache
|
|
109
|
-
|
|
110
|
-
# Serverless directories
|
|
111
|
-
.serverless/
|
|
112
|
-
|
|
113
|
-
# FuseBox cache
|
|
114
|
-
.fusebox/
|
|
115
|
-
|
|
116
|
-
# DynamoDB Local files
|
|
117
|
-
.dynamodb/
|
|
118
|
-
|
|
119
|
-
# TernJS port file
|
|
120
|
-
.tern-port
|
|
121
|
-
|
|
122
|
-
# Stores VSCode versions used for testing VSCode extensions
|
|
123
|
-
.vscode-test
|
|
124
|
-
|
|
125
|
-
# yarn v2
|
|
126
|
-
.yarn/cache
|
|
127
|
-
.yarn/unplugged
|
|
128
|
-
.yarn/build-state.yml
|
|
129
|
-
.yarn/install-state.gz
|
|
130
|
-
.pnp.*
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { CommandType, ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from "reciple";
|
|
3
|
-
|
|
4
|
-
export class PingCommand {
|
|
5
|
-
/**
|
|
6
|
-
* The module commands.
|
|
7
|
-
* @typedef {import("reciple").AnyCommandResolvable[]}
|
|
8
|
-
*/
|
|
9
|
-
commands = [
|
|
10
|
-
new SlashCommandBuilder()
|
|
11
|
-
.setName('ping')
|
|
12
|
-
.setDescription('Replies with pong!')
|
|
13
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
14
|
-
|
|
15
|
-
new ContextMenuCommandBuilder()
|
|
16
|
-
.setName('ping')
|
|
17
|
-
.setType('Message')
|
|
18
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
19
|
-
|
|
20
|
-
new MessageCommandBuilder()
|
|
21
|
-
.setName('ping')
|
|
22
|
-
.setDescription('Replies with pong!')
|
|
23
|
-
.setExecute(data => this.handleCommandExecute(data))
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Executed when module is started (Bot is not logged in).
|
|
28
|
-
*
|
|
29
|
-
* @return {Promise<boolean>}
|
|
30
|
-
*/
|
|
31
|
-
async onStart() {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
37
|
-
*
|
|
38
|
-
* @return {Promise<void>}
|
|
39
|
-
*/
|
|
40
|
-
async onLoad() {}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
44
|
-
*
|
|
45
|
-
* @return {Promise<void>}
|
|
46
|
-
*/
|
|
47
|
-
async onUnload() {}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Called by the command builder when a command is executed.
|
|
51
|
-
*
|
|
52
|
-
* @param {import("reciple").AnyCommandExecuteData} data
|
|
53
|
-
* @returns {Promise<void>}
|
|
54
|
-
*/
|
|
55
|
-
async handleCommandExecute(data) {
|
|
56
|
-
switch (data.type) {
|
|
57
|
-
case CommandType.ContextMenuCommand:
|
|
58
|
-
case CommandType.SlashCommand:
|
|
59
|
-
await data.interaction.reply('Pong!');
|
|
60
|
-
return;
|
|
61
|
-
case CommandType.MessageCommand:
|
|
62
|
-
await data.message.reply('Pong!');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default new PingCommand();
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { GuildMember } from "discord.js";
|
|
4
|
-
|
|
5
|
-
export class WelcomeEvent {
|
|
6
|
-
constructor() {
|
|
7
|
-
// Make sure `handleWelcomeEvent` is bound to `this`
|
|
8
|
-
this.handleWelcomeEvent = this.handleWelcomeEvent.bind(this);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Executed when module is started (Bot is not logged in).
|
|
13
|
-
*
|
|
14
|
-
* @return {Promise<boolean>}
|
|
15
|
-
*/
|
|
16
|
-
async onStart() {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
22
|
-
*
|
|
23
|
-
* @param {import("reciple").RecipleModuleLoadData} param0
|
|
24
|
-
* @return {Promise<void>}
|
|
25
|
-
*/
|
|
26
|
-
async onLoad({ client }) {
|
|
27
|
-
// Add the listener to the client
|
|
28
|
-
client.on('guildMemberAdd', this.handleWelcomeEvent);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
33
|
-
*
|
|
34
|
-
* @param {import("reciple").RecipleModuleUnloadData} param0
|
|
35
|
-
* @return {Promise<void>}
|
|
36
|
-
*/
|
|
37
|
-
async onUnload({ client }) {
|
|
38
|
-
// Properly remove the listener from the client
|
|
39
|
-
client.removeListener('guildMemberAdd', this.handleWelcomeEvent);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Called when a user joins the server.
|
|
44
|
-
*
|
|
45
|
-
* @param {GuildMember} member
|
|
46
|
-
* @return {Promise<void>}
|
|
47
|
-
*/
|
|
48
|
-
async handleWelcomeEvent(member) {
|
|
49
|
-
await member.send(`Welcome to **${member.guild.name}** server!`)
|
|
50
|
-
.catch(() => null);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default new WelcomeEvent();
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { CommandHaltReason, CommandType } from 'reciple';
|
|
4
|
-
|
|
5
|
-
export class CommandErrorHalt {
|
|
6
|
-
id = 'my.reciple.js.commanderrorhalt';
|
|
7
|
-
disabled = false;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {import('reciple').ContextMenuCommandHaltTriggerData} data
|
|
11
|
-
*/
|
|
12
|
-
contextMenuCommandHalt(data) {
|
|
13
|
-
return this.halt(data);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {import('reciple').MessageCommandHaltTriggerData} data
|
|
18
|
-
*/
|
|
19
|
-
messageCommandHalt(data) {
|
|
20
|
-
return this.halt(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {import('reciple').SlashCommandHaltTriggerData} data
|
|
25
|
-
*/
|
|
26
|
-
slashCommandHalt(data) {
|
|
27
|
-
return this.halt(data);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @param {import('reciple').AnyCommandHaltTriggerData} data
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
async halt(data) {
|
|
35
|
-
if (data.reason !== CommandHaltReason.Error) return;
|
|
36
|
-
|
|
37
|
-
const content = `An error occured while executing this command`;
|
|
38
|
-
|
|
39
|
-
switch (data.commandType) {
|
|
40
|
-
case CommandType.ContextMenuCommand:
|
|
41
|
-
case CommandType.SlashCommand:
|
|
42
|
-
const interaction = data.executeData.interaction;
|
|
43
|
-
|
|
44
|
-
if (interaction.replied || interaction.deferred) {
|
|
45
|
-
await interaction.editReply(content);
|
|
46
|
-
} else {
|
|
47
|
-
await interaction.reply(content);
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case CommandType.MessageCommand:
|
|
51
|
-
await data.executeData.message.reply(content);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
reciple.logger?.error(data.error);
|
|
56
|
-
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
export class ExamplePrecondition {
|
|
4
|
-
id = 'my.reciple.js.exampleprecondition';
|
|
5
|
-
disabled = false;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {import("reciple").ContextMenuCommandExecuteData} execute
|
|
9
|
-
*/
|
|
10
|
-
contextMenuCommandExecute(execute) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {import("reciple").MessageCommandExecuteData} excute
|
|
16
|
-
*/
|
|
17
|
-
messageCommandExecute(excute) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {import("reciple").SlashCommandExecuteData} execute
|
|
23
|
-
*/
|
|
24
|
-
slashCommandExecute(execute) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
-
"restartable": "r",
|
|
4
|
-
"ext": "js,mjs,json",
|
|
5
|
-
"signal": "SIGHUP",
|
|
6
|
-
"ignore": [
|
|
7
|
-
".git",
|
|
8
|
-
"node_modules/**"
|
|
9
|
-
],
|
|
10
|
-
"watch": [
|
|
11
|
-
"src",
|
|
12
|
-
"reciple.mjs",
|
|
13
|
-
".env"
|
|
14
|
-
],
|
|
15
|
-
"exec": "reciple start"
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reciple-app",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "reciple start -c reciple.mjs",
|
|
7
|
-
"dev": "nodemon --config nodemon.json"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@reciple/core": "RECIPLE_CORE",
|
|
11
|
-
"discord.js": "DISCORDJS",
|
|
12
|
-
"reciple": "RECIPLE"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@types/node": "TYPES_NODE",
|
|
16
|
-
"nodemon": "NODEMON"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
lerna-debug.log*
|
|
8
|
-
.pnpm-debug.log*
|
|
9
|
-
|
|
10
|
-
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
-
|
|
13
|
-
# Runtime data
|
|
14
|
-
pids
|
|
15
|
-
*.pid
|
|
16
|
-
*.seed
|
|
17
|
-
*.pid.lock
|
|
18
|
-
|
|
19
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
20
|
-
lib-cov
|
|
21
|
-
|
|
22
|
-
# Docs files
|
|
23
|
-
docs.json
|
|
24
|
-
|
|
25
|
-
# Coverage directory used by tools like istanbul
|
|
26
|
-
coverage
|
|
27
|
-
*.lcov
|
|
28
|
-
|
|
29
|
-
# nyc test coverage
|
|
30
|
-
.nyc_output
|
|
31
|
-
|
|
32
|
-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
33
|
-
.grunt
|
|
34
|
-
|
|
35
|
-
# Bower dependency directory (https://bower.io/)
|
|
36
|
-
bower_components
|
|
37
|
-
|
|
38
|
-
# node-waf configuration
|
|
39
|
-
.lock-wscript
|
|
40
|
-
|
|
41
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
42
|
-
build/Release
|
|
43
|
-
|
|
44
|
-
# Dependency directories
|
|
45
|
-
node_modules/
|
|
46
|
-
jspm_packages/
|
|
47
|
-
|
|
48
|
-
# Snowpack dependency directory (https://snowpack.dev/)
|
|
49
|
-
web_modules/
|
|
50
|
-
|
|
51
|
-
# TypeScript cache
|
|
52
|
-
*.tsbuildinfo
|
|
53
|
-
|
|
54
|
-
# Optional npm cache directory
|
|
55
|
-
.npm
|
|
56
|
-
|
|
57
|
-
# Optional eslint cache
|
|
58
|
-
.eslintcache
|
|
59
|
-
|
|
60
|
-
# Optional stylelint cache
|
|
61
|
-
.stylelintcache
|
|
62
|
-
|
|
63
|
-
# Microbundle cache
|
|
64
|
-
.rpt2_cache/
|
|
65
|
-
.rts2_cache_cjs/
|
|
66
|
-
.rts2_cache_es/
|
|
67
|
-
.rts2_cache_umd/
|
|
68
|
-
|
|
69
|
-
# Optional REPL history
|
|
70
|
-
.node_repl_history
|
|
71
|
-
|
|
72
|
-
# Output of 'npm pack'
|
|
73
|
-
*.tgz
|
|
74
|
-
|
|
75
|
-
# Yarn Integrity file
|
|
76
|
-
.yarn-integrity
|
|
77
|
-
|
|
78
|
-
# dotenv environment variable files
|
|
79
|
-
.env
|
|
80
|
-
.env.development.local
|
|
81
|
-
.env.test.local
|
|
82
|
-
.env.production.local
|
|
83
|
-
.env.local
|
|
84
|
-
|
|
85
|
-
# parcel-bundler cache (https://parceljs.org/)
|
|
86
|
-
.cache
|
|
87
|
-
.parcel-cache
|
|
88
|
-
|
|
89
|
-
# Next.js build output
|
|
90
|
-
.next
|
|
91
|
-
out
|
|
92
|
-
|
|
93
|
-
# Nuxt.js build / generate output
|
|
94
|
-
.nuxt
|
|
95
|
-
dist
|
|
96
|
-
|
|
97
|
-
# Gatsby files
|
|
98
|
-
.cache/
|
|
99
|
-
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
100
|
-
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
101
|
-
# public
|
|
102
|
-
|
|
103
|
-
# vuepress build output
|
|
104
|
-
.vuepress/dist
|
|
105
|
-
|
|
106
|
-
# vuepress v2.x temp and cache directory
|
|
107
|
-
.temp
|
|
108
|
-
.cache
|
|
109
|
-
|
|
110
|
-
# Serverless directories
|
|
111
|
-
.serverless/
|
|
112
|
-
|
|
113
|
-
# FuseBox cache
|
|
114
|
-
.fusebox/
|
|
115
|
-
|
|
116
|
-
# DynamoDB Local files
|
|
117
|
-
.dynamodb/
|
|
118
|
-
|
|
119
|
-
# TernJS port file
|
|
120
|
-
.tern-port
|
|
121
|
-
|
|
122
|
-
# Stores VSCode versions used for testing VSCode extensions
|
|
123
|
-
.vscode-test
|
|
124
|
-
|
|
125
|
-
# yarn v2
|
|
126
|
-
.yarn/cache
|
|
127
|
-
.yarn/unplugged
|
|
128
|
-
.yarn/build-state.yml
|
|
129
|
-
.yarn/install-state.gz
|
|
130
|
-
.pnp.*
|
|
131
|
-
|
|
132
|
-
# Output files
|
|
133
|
-
modules
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
|
|
3
|
-
"restartable": "r",
|
|
4
|
-
"ext": "ts,mts,mjs,json",
|
|
5
|
-
"signal": "SIGHUP",
|
|
6
|
-
"ignore": [
|
|
7
|
-
".git",
|
|
8
|
-
"node_modules/**",
|
|
9
|
-
"modules"
|
|
10
|
-
],
|
|
11
|
-
"watch": [
|
|
12
|
-
"src",
|
|
13
|
-
"reciple.mjs",
|
|
14
|
-
".env"
|
|
15
|
-
],
|
|
16
|
-
"exec": "rimraf ./modules && tsc && reciple start"
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "reciple-app",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "rimraf ./modules && tsc",
|
|
7
|
-
"start": "reciple start -c reciple.mjs",
|
|
8
|
-
"build:start": "SCRIPT_RUN build && reciple start -c reciple.mjs",
|
|
9
|
-
"dev": "nodemon --config nodemon.json"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@reciple/core": "RECIPLE_CORE",
|
|
13
|
-
"discord.js": "DISCORDJS",
|
|
14
|
-
"reciple": "RECIPLE"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@types/node": "TYPES_NODE",
|
|
18
|
-
"typescript": "TYPESCRIPT",
|
|
19
|
-
"rimraf": "RIMRAF"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AnyCommandExecuteData, CommandType, ContextMenuCommandBuilder, MessageCommandBuilder, RecipleModuleData, SlashCommandBuilder, type AnyCommandResolvable } from "reciple";
|
|
2
|
-
|
|
3
|
-
export class PingCommand implements RecipleModuleData {
|
|
4
|
-
public commands: AnyCommandResolvable[] = [
|
|
5
|
-
new ContextMenuCommandBuilder()
|
|
6
|
-
.setName('ping')
|
|
7
|
-
.setType('Message')
|
|
8
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
9
|
-
new MessageCommandBuilder()
|
|
10
|
-
.setName('ping')
|
|
11
|
-
.setDescription('Replies with pong!')
|
|
12
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
13
|
-
new SlashCommandBuilder()
|
|
14
|
-
.setName('ping')
|
|
15
|
-
.setDescription('Replies with pong!')
|
|
16
|
-
.setExecute(data => this.handleCommandExecute(data)),
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Executed when module is started (Bot is not logged in).
|
|
21
|
-
*/
|
|
22
|
-
async onStart(): Promise<boolean> {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
28
|
-
*/
|
|
29
|
-
async onLoad(): Promise<void> {}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
33
|
-
*/
|
|
34
|
-
async onUnload(): Promise<void> {}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Sets the commands
|
|
38
|
-
*/
|
|
39
|
-
async handleCommandExecute(data: AnyCommandExecuteData): Promise<void> {
|
|
40
|
-
switch (data.type) {
|
|
41
|
-
case CommandType.ContextMenuCommand:
|
|
42
|
-
case CommandType.SlashCommand:
|
|
43
|
-
await data.interaction.reply('Pong!');
|
|
44
|
-
return;
|
|
45
|
-
case CommandType.MessageCommand:
|
|
46
|
-
await data.message.reply('Pong!');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default new PingCommand();
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { GuildMember } from "discord.js";
|
|
2
|
-
import { RecipleModuleData, type RecipleModuleLoadData } from 'reciple';
|
|
3
|
-
|
|
4
|
-
export class WelcomeEvent implements RecipleModuleData {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.handleWelcomeEvent = this.handleWelcomeEvent.bind(this);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Executed when module is started (Bot is not logged in).
|
|
11
|
-
*/
|
|
12
|
-
async onStart(): Promise<boolean> {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Executes when the module is loaded (Bot is logged in).
|
|
18
|
-
*/
|
|
19
|
-
async onLoad({ client }: RecipleModuleLoadData): Promise<void> {
|
|
20
|
-
client.on('guildMemberAdd', this.handleWelcomeEvent);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Executes when the module is unloaded (Bot is pre log out).
|
|
25
|
-
*/
|
|
26
|
-
async onUnload({ client }: RecipleModuleLoadData): Promise<void> {
|
|
27
|
-
client.removeListener('guildMemberAdd', this.handleWelcomeEvent);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Called when a user joins the server.
|
|
32
|
-
*/
|
|
33
|
-
async handleWelcomeEvent(member: GuildMember): Promise<void> {
|
|
34
|
-
await member.send(`Welcome to **${member.guild.name}** server!`)
|
|
35
|
-
.catch(() => null);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default new WelcomeEvent();
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { AnyCommandHaltTriggerData, CommandHaltData, CommandHaltReason, CommandType, ContextMenuCommandHaltTriggerData, MessageCommandHaltTriggerData, SlashCommandHaltTriggerData } from 'reciple';
|
|
2
|
-
|
|
3
|
-
export class CommandErrorHalt implements CommandHaltData {
|
|
4
|
-
id = 'my.reciple.js.commanderrorhalt';
|
|
5
|
-
disabled = false;
|
|
6
|
-
|
|
7
|
-
contextMenuCommandHalt(data: ContextMenuCommandHaltTriggerData) {
|
|
8
|
-
return this.halt(data);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
messageCommandHalt(data: MessageCommandHaltTriggerData) {
|
|
12
|
-
return this.halt(data);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
slashCommandHalt(data: SlashCommandHaltTriggerData) {
|
|
16
|
-
return this.halt(data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async halt(data: AnyCommandHaltTriggerData) {
|
|
20
|
-
if (data.reason !== CommandHaltReason.Error) return;
|
|
21
|
-
|
|
22
|
-
const content = `An error occured while executing this command`;
|
|
23
|
-
|
|
24
|
-
switch (data.commandType) {
|
|
25
|
-
case CommandType.ContextMenuCommand:
|
|
26
|
-
case CommandType.SlashCommand:
|
|
27
|
-
const interaction = data.executeData.interaction;
|
|
28
|
-
|
|
29
|
-
if (interaction.replied || interaction.deferred) {
|
|
30
|
-
await interaction.editReply(content);
|
|
31
|
-
} else {
|
|
32
|
-
await interaction.reply(content);
|
|
33
|
-
}
|
|
34
|
-
break;
|
|
35
|
-
case CommandType.MessageCommand:
|
|
36
|
-
await data.executeData.message.reply(content);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
reciple.logger?.error(data.error);
|
|
41
|
-
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|