generator-discord 1.0.1
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/.github/workflows/build.yml +30 -0
- package/LICENSE.md +21 -0
- package/README.md +28 -0
- package/assets/Icon.afdesign +0 -0
- package/assets/icon.svg +33 -0
- package/package.json +35 -0
- package/src/index.ts +142 -0
- package/templates/javascript/package.json +14 -0
- package/templates/javascript/src/index.js +32 -0
- package/templates/typescript/package-lock.json +468 -0
- package/templates/typescript/package.json +17 -0
- package/templates/typescript/src/index.ts +31 -0
- package/templates/typescript/tsconfig.json +25 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Build
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "main" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "main" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node-version: [12.x, 14.x, 16.x]
|
|
20
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
- run: npm i
|
|
30
|
+
- run: npm run build
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Emil Krebs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div id="logo" align="center">
|
|
2
|
+
<a href="https://github.com/emilkrebs/Generator-Discord" target="_blank" rel="noopener noreferrer">
|
|
3
|
+
<img width="256" alt="Generator-Discord Logo" src="https://raw.githubusercontent.com/emilkrebs/Generator-Discord/main/assets/icon.svg">
|
|
4
|
+
</a>
|
|
5
|
+
<h3>
|
|
6
|
+
Yeomon Generator for Discord.js
|
|
7
|
+
</h3>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div id="badges" align="center">
|
|
11
|
+
|
|
12
|
+
[](https://github.com/emilkrebs/sound-bot/actions/workflows/build.yml)
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<hr>
|
|
17
|
+
|
|
18
|
+
# Getting started
|
|
19
|
+
- Install [node.js](https://nodejs.org/en/)
|
|
20
|
+
- Install Yeoman using `npm install -g yo`
|
|
21
|
+
- Install this Generator using `npm install -g generator-discord`
|
|
22
|
+
- To create a new Project run `yo discord`
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## Known Issue
|
|
27
|
+
|
|
28
|
+
[Add Issue](https://github.com/emilkrebs/Generator-Discord/issues/new)
|
|
Binary file
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 894 834" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-93.0082,-271.112)">
|
|
5
|
+
<g id="Dude" transform="matrix(1,0,0,1,24.8331,-0.5921)">
|
|
6
|
+
<g transform="matrix(2.3043,0,0,2.3043,-74.7522,214.623)">
|
|
7
|
+
<path d="M358.75,173.61C363.307,160.425 368.661,146.421 373.252,133.889C363.943,124.341 359.753,110.266 363.452,96.459C369.035,75.625 390.481,63.243 411.315,68.826C432.149,74.408 444.531,95.854 438.948,116.688C434.062,134.926 417.018,146.687 398.871,145.59C396.145,159.711 391.757,173.606 387.095,185.912C425.614,206.228 449.513,236.122 449.973,269.422C451.367,370.367 361.558,374.937 272.315,377.122C178.376,379.423 84.689,374.063 83.247,269.422C82.784,235.853 108.002,205.745 147.065,185.42C142.076,180.828 137.373,176.909 133.457,174.338C128.282,170.942 122.039,168.563 115.601,166.752C102.791,177.519 83.624,176.877 71.573,164.826C58.844,152.097 58.844,131.428 71.573,118.699C84.303,105.97 104.972,105.97 117.701,118.699C122.563,123.561 125.568,129.583 126.715,135.875C136.874,138.943 147.714,143.695 157.129,149.875C163.742,154.215 172.645,162.45 181.399,171.29C206.859,163.19 235.856,158.604 266.61,158.604C300.189,158.604 331.671,164.071 358.75,173.61ZM335.729,245.303C351.492,245.303 364.29,258.101 364.29,273.865C364.29,289.628 351.492,302.426 335.729,302.426C319.965,302.426 307.167,289.628 307.167,273.865C307.167,258.101 319.965,245.303 335.729,245.303ZM197.492,243.934C213.256,243.934 226.054,256.732 226.054,272.495C226.054,288.258 213.256,301.056 197.492,301.056C181.729,301.056 168.931,288.258 168.931,272.495C168.931,256.732 181.729,243.934 197.492,243.934Z" style="fill:rgb(82,97,247);"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g transform="matrix(-0.578814,-0.199436,-0.238993,0.69362,1304.19,412.961)">
|
|
10
|
+
<path d="M361.431,850.207C347.879,848.598 334.121,848.598 320.569,850.207L313.17,869.806C299.938,872.366 287.304,876.733 275.779,882.731L253.939,873.238C242.992,880.097 233.265,888.214 225.046,897.349L236.421,915.574C229.233,925.192 224,935.734 220.933,946.776L197.447,952.951C195.518,964.26 195.518,975.74 197.447,987.049L220.933,993.224C224,1004.27 229.233,1014.81 236.421,1024.43L225.046,1042.65C233.265,1051.79 242.992,1059.9 253.939,1066.76L275.779,1057.27C287.304,1063.27 299.938,1067.63 313.17,1070.19L320.569,1089.79C334.121,1091.4 347.879,1091.4 361.431,1089.79L368.83,1070.19C382.062,1067.63 394.696,1063.27 406.221,1057.27L428.061,1066.76C439.008,1059.9 448.735,1051.79 456.954,1042.65L445.579,1024.43C452.767,1014.81 458,1004.27 461.067,993.224L484.553,987.049C486.482,975.74 486.482,964.26 484.553,952.951L461.067,946.776C458,935.734 452.767,925.192 445.579,915.574L456.954,897.349C448.735,888.214 439.008,880.097 428.061,873.238L406.221,882.731C394.696,876.733 382.062,872.366 368.83,869.806L361.431,850.207Z" style="fill:rgb(82,97,247);"/>
|
|
11
|
+
</g>
|
|
12
|
+
<g transform="matrix(-0.578814,-0.199436,-0.238993,0.69362,631.539,412.961)">
|
|
13
|
+
<path d="M361.431,850.207C347.879,848.598 334.121,848.598 320.569,850.207L313.17,869.806C299.938,872.366 287.304,876.733 275.779,882.731L253.939,873.238C242.992,880.097 233.265,888.214 225.046,897.349L236.421,915.574C229.233,925.192 224,935.734 220.933,946.776L197.447,952.951C195.518,964.26 195.518,975.74 197.447,987.049L220.933,993.224C224,1004.27 229.233,1014.81 236.421,1024.43L225.046,1042.65C233.265,1051.79 242.992,1059.9 253.939,1066.76L275.779,1057.27C287.304,1063.27 299.938,1067.63 313.17,1070.19L320.569,1089.79C334.121,1091.4 347.879,1091.4 361.431,1089.79L368.83,1070.19C382.062,1067.63 394.696,1063.27 406.221,1057.27L428.061,1066.76C439.008,1059.9 448.735,1051.79 456.954,1042.65L445.579,1024.43C452.767,1014.81 458,1004.27 461.067,993.224L484.553,987.049C486.482,975.74 486.482,964.26 484.553,952.951L461.067,946.776C458,935.734 452.767,925.192 445.579,915.574L456.954,897.349C448.735,888.214 439.008,880.097 428.061,873.238L406.221,882.731C394.696,876.733 382.062,872.366 368.83,869.806L361.431,850.207Z" style="fill:rgb(82,97,247);"/>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
<g id="Hat" transform="matrix(1,0,0,1,18,55.8625)">
|
|
17
|
+
<g transform="matrix(1,0,0,1.36284,-9,-191.217)">
|
|
18
|
+
<path d="M396.048,381.052C395.687,379.707 395.5,378.356 395.5,377C395.5,335.192 468.762,298.25 559,298.25C649.238,298.25 722.5,335.192 722.5,377C722.5,378.356 722.313,379.707 721.952,381.052L702.204,527L415.796,527L396.048,381.052Z" style="fill:rgb(48,53,103);"/>
|
|
19
|
+
<clipPath id="_clip1">
|
|
20
|
+
<path d="M396.048,381.052C395.687,379.707 395.5,378.356 395.5,377C395.5,335.192 468.762,298.25 559,298.25C649.238,298.25 722.5,335.192 722.5,377C722.5,378.356 722.313,379.707 721.952,381.052L702.204,527L415.796,527L396.048,381.052Z"/>
|
|
21
|
+
</clipPath>
|
|
22
|
+
<g clip-path="url(#_clip1)">
|
|
23
|
+
<g transform="matrix(0.877119,0,0,0.683157,105.53,200.906)">
|
|
24
|
+
<path d="M753,421.75C753,409.746 742.655,400 729.913,400L304.087,400C291.345,400 281,409.746 281,421.75L281,465.25C281,477.254 291.345,487 304.087,487L729.913,487C742.655,487 753,477.254 753,465.25L753,421.75Z" style="fill:rgb(82,97,247);"/>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
</g>
|
|
28
|
+
<g transform="matrix(0.877119,0,0,0.448276,96.5297,347.69)">
|
|
29
|
+
<path d="M753,421.75C753,409.746 748.019,400 741.884,400L292.116,400C285.981,400 281,409.746 281,421.75L281,465.25C281,477.254 285.981,487 292.116,487L741.884,487C748.019,487 753,477.254 753,465.25L753,421.75Z" style="fill:rgb(62,68,128);"/>
|
|
30
|
+
</g>
|
|
31
|
+
</g>
|
|
32
|
+
</g>
|
|
33
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "generator-discord",
|
|
3
|
+
"displayName": "Generator-Discord",
|
|
4
|
+
"version": "1.0.1",
|
|
5
|
+
"main": "./app/src/index.js",
|
|
6
|
+
"description": "Yeoman generator for Discord.js",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"yeoman-generator",
|
|
9
|
+
"discord.js",
|
|
10
|
+
"discord",
|
|
11
|
+
"discord bot"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"watch": "tsc -w",
|
|
16
|
+
"debug": "npx --node-arg=--inspect yo discord"
|
|
17
|
+
},
|
|
18
|
+
"author": "Emil Krebs",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/emilkrebs/Generator-Discord.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/emilkrebs/Generator-Discord/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/emilkrebs/Sound-bot",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"typescript": "^4.7.2",
|
|
30
|
+
"yeoman-generator": "^5.6.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/yeoman-generator": "^5.2.10"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import Generator from 'yeoman-generator';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const TEMPLATE_DIR = '../templates/';
|
|
6
|
+
const USER_DIR = '.';
|
|
7
|
+
|
|
8
|
+
const OPEN = '<%= ';
|
|
9
|
+
const CLOSE = ' %>';
|
|
10
|
+
|
|
11
|
+
const BOT_NAME = 'bot-name';
|
|
12
|
+
const BOT_TOKEN = 'bot-token';
|
|
13
|
+
|
|
14
|
+
interface Answers {
|
|
15
|
+
botName: string;
|
|
16
|
+
programmingLanguage: string;
|
|
17
|
+
botToken: string;
|
|
18
|
+
openWithCode: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export default class DiscordGenerator extends Generator {
|
|
23
|
+
private answers: Answers;
|
|
24
|
+
|
|
25
|
+
constructor(args: string | string[], options: Generator.GeneratorOptions) {
|
|
26
|
+
super(args, options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async prompting(): Promise<void> {
|
|
30
|
+
this.logo();
|
|
31
|
+
this.answers = await this.prompt([
|
|
32
|
+
{
|
|
33
|
+
type: 'input',
|
|
34
|
+
name: 'botName',
|
|
35
|
+
message: 'Your Discord Bot name:',
|
|
36
|
+
default: 'my-bot',
|
|
37
|
+
validate: (input: string): boolean | string =>
|
|
38
|
+
new RegExp("^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$").test(input)
|
|
39
|
+
? true
|
|
40
|
+
: 'Your Discord Bot name does not match the pattern of: ^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$',
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'list',
|
|
45
|
+
name: 'programmingLanguage',
|
|
46
|
+
message: 'The programming language you want to use.',
|
|
47
|
+
choices: [
|
|
48
|
+
{
|
|
49
|
+
name: 'TypeScript',
|
|
50
|
+
value: 'typescript'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'JavaScript',
|
|
54
|
+
value: 'javascript'
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'input',
|
|
60
|
+
name: 'botToken',
|
|
61
|
+
message: 'Your Discord Bot Token. (Enter to leave blank)',
|
|
62
|
+
default: 'your-bot-token'
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
logo(): void {
|
|
68
|
+
this.log(" \x1b[36m_____ _ _ \x1b[31m_ ");
|
|
69
|
+
this.log(" \x1b[36m| __ \\(_) | | \x1b[31m(_) ");
|
|
70
|
+
this.log(" \x1b[36m| | | |_ ___ ___ ___ _ __ __| | \x1b[33m_ ___ ");
|
|
71
|
+
this.log(" \x1b[36m| | | | / __|/ __/ _ \\| '__/ _` | \x1b[33m| / __|");
|
|
72
|
+
this.log(" \x1b[36m| |__| | \\__ \\ (_| (_) | | | (_| |_\x1b[32m| \\__ \\");
|
|
73
|
+
this.log(" \x1b[36m|_____/|_|___/\\___\\___/|_| \\__,_(_\x1b[34m) |___/");
|
|
74
|
+
this.log(" \x1b[35m_/ | ");
|
|
75
|
+
this.log(" \x1b[35m|__/ ");
|
|
76
|
+
this.log("\x1b[0m");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
writing(): void {
|
|
80
|
+
this.sourceRoot(path.join(__dirname, TEMPLATE_DIR + this.answers.programmingLanguage));
|
|
81
|
+
['.'].forEach(
|
|
82
|
+
(path: string) => {
|
|
83
|
+
const replaceWords = (
|
|
84
|
+
answers: Answers,
|
|
85
|
+
content: Buffer
|
|
86
|
+
): string =>
|
|
87
|
+
[
|
|
88
|
+
[BOT_NAME, this.answers.botName],
|
|
89
|
+
[BOT_TOKEN, this.answers.botToken]
|
|
90
|
+
].reduce(
|
|
91
|
+
(acc: string, [templateWord, userAnswer]) =>
|
|
92
|
+
acc.replace(
|
|
93
|
+
new RegExp(
|
|
94
|
+
`${OPEN}${templateWord}${CLOSE}`,
|
|
95
|
+
'g'
|
|
96
|
+
),
|
|
97
|
+
userAnswer
|
|
98
|
+
),
|
|
99
|
+
content.toString()
|
|
100
|
+
);
|
|
101
|
+
this.fs.copy(
|
|
102
|
+
this.templatePath(path),
|
|
103
|
+
this.destinationPath(
|
|
104
|
+
USER_DIR,
|
|
105
|
+
this.answers.botName,
|
|
106
|
+
path
|
|
107
|
+
),
|
|
108
|
+
{
|
|
109
|
+
process: (content: Buffer) =>
|
|
110
|
+
replaceWords(this.answers, content)
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
async install(): Promise<void> {
|
|
117
|
+
const answer = await this.prompt({
|
|
118
|
+
type: 'list',
|
|
119
|
+
name: 'openWithCode',
|
|
120
|
+
message: 'Do you want to open your Discord Bot with Visual Studio Code?',
|
|
121
|
+
choices: [
|
|
122
|
+
{
|
|
123
|
+
name: 'open with `code`',
|
|
124
|
+
value: true
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'skip',
|
|
128
|
+
value: false
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
this.log('Your Discord Bot ' + this.answers.botName + ' has been created!');
|
|
133
|
+
|
|
134
|
+
this.log(this.destinationRoot());
|
|
135
|
+
if (answer && answer.openWithCode) {
|
|
136
|
+
this.spawnCommand('code', [this.destinationPath(
|
|
137
|
+
USER_DIR,
|
|
138
|
+
this.answers.botName
|
|
139
|
+
)]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= bot-name %>",
|
|
3
|
+
"displayName": "<%= bot-name %>",
|
|
4
|
+
"description": "Please enter a brief description here",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node ./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"colors": "^1.4.0",
|
|
12
|
+
"discord.js": "^13.8.0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { Client, Intents } = require('discord.js');
|
|
2
|
+
const colors = require('colors');
|
|
3
|
+
const { token } = require('../config.json');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
|
7
|
+
|
|
8
|
+
// run this code once when your client is ready
|
|
9
|
+
client.once('ready', () => {
|
|
10
|
+
console.log(getTime() + colors.green('Bot is Ready.'));
|
|
11
|
+
console.log(getTime() + colors.green(`Bot is logged in as ${colors.yellow(client.user.tag)}.`));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// run this code when a new message is created
|
|
15
|
+
client.on('messageCreate', async message => {
|
|
16
|
+
const { content } = message;
|
|
17
|
+
if (content === "!ping") {
|
|
18
|
+
return await message.reply("pong!");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// get the current time to get useful log messages
|
|
24
|
+
function getTime() {
|
|
25
|
+
let dateTime = new Date()
|
|
26
|
+
return colors.gray(`[${dateTime.getHours()}:${dateTime.getMinutes()}:${dateTime.getSeconds()}] `);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// login with your client's token
|
|
30
|
+
client.login(token);
|
|
31
|
+
|
|
32
|
+
// for more information check out the official guide: https://discordjs.guide/creating-your-bot
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= bot-name %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"lockfileVersion": 2,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "<%= bot-name %>",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"colors": "^1.4.0",
|
|
12
|
+
"discord.js": "^13.8.0",
|
|
13
|
+
"typescript": "^4.7.2"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"node_modules/@discordjs/builders": {
|
|
17
|
+
"version": "0.14.0",
|
|
18
|
+
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz",
|
|
19
|
+
"integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sapphire/shapeshift": "^3.1.0",
|
|
22
|
+
"@sindresorhus/is": "^4.6.0",
|
|
23
|
+
"discord-api-types": "^0.33.3",
|
|
24
|
+
"fast-deep-equal": "^3.1.3",
|
|
25
|
+
"ts-mixer": "^6.0.1",
|
|
26
|
+
"tslib": "^2.4.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16.9.0"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"node_modules/@discordjs/collection": {
|
|
33
|
+
"version": "0.7.0",
|
|
34
|
+
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.7.0.tgz",
|
|
35
|
+
"integrity": "sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA==",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=16.9.0"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"node_modules/@sapphire/async-queue": {
|
|
41
|
+
"version": "1.3.1",
|
|
42
|
+
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz",
|
|
43
|
+
"integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g==",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=v14.0.0",
|
|
46
|
+
"npm": ">=7.0.0"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"node_modules/@sapphire/shapeshift": {
|
|
50
|
+
"version": "3.2.0",
|
|
51
|
+
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.2.0.tgz",
|
|
52
|
+
"integrity": "sha512-asNgE5Ooil2/oGIAj6vZMoUc2ZFED0TGYD7jwvZsjHPQZBEh9ITj94ca4bCgiCR1s2ER/UjzykH+5wE3ebVZnQ==",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=v15.0.0",
|
|
55
|
+
"npm": ">=7.0.0"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"node_modules/@sindresorhus/is": {
|
|
59
|
+
"version": "4.6.0",
|
|
60
|
+
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
|
61
|
+
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=10"
|
|
64
|
+
},
|
|
65
|
+
"funding": {
|
|
66
|
+
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"node_modules/@types/node": {
|
|
70
|
+
"version": "18.0.0",
|
|
71
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.0.tgz",
|
|
72
|
+
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA=="
|
|
73
|
+
},
|
|
74
|
+
"node_modules/@types/node-fetch": {
|
|
75
|
+
"version": "2.6.2",
|
|
76
|
+
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
|
|
77
|
+
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@types/node": "*",
|
|
80
|
+
"form-data": "^3.0.0"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"node_modules/@types/node-fetch/node_modules/form-data": {
|
|
84
|
+
"version": "3.0.1",
|
|
85
|
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
|
|
86
|
+
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"asynckit": "^0.4.0",
|
|
89
|
+
"combined-stream": "^1.0.8",
|
|
90
|
+
"mime-types": "^2.1.12"
|
|
91
|
+
},
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">= 6"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"node_modules/@types/ws": {
|
|
97
|
+
"version": "8.5.3",
|
|
98
|
+
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
|
|
99
|
+
"integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==",
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"@types/node": "*"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"node_modules/asynckit": {
|
|
105
|
+
"version": "0.4.0",
|
|
106
|
+
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
107
|
+
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
|
108
|
+
},
|
|
109
|
+
"node_modules/colors": {
|
|
110
|
+
"version": "1.4.0",
|
|
111
|
+
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
|
112
|
+
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
|
|
113
|
+
"engines": {
|
|
114
|
+
"node": ">=0.1.90"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"node_modules/combined-stream": {
|
|
118
|
+
"version": "1.0.8",
|
|
119
|
+
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
|
120
|
+
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
|
121
|
+
"dependencies": {
|
|
122
|
+
"delayed-stream": "~1.0.0"
|
|
123
|
+
},
|
|
124
|
+
"engines": {
|
|
125
|
+
"node": ">= 0.8"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"node_modules/delayed-stream": {
|
|
129
|
+
"version": "1.0.0",
|
|
130
|
+
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
|
131
|
+
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
|
132
|
+
"engines": {
|
|
133
|
+
"node": ">=0.4.0"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"node_modules/discord-api-types": {
|
|
137
|
+
"version": "0.33.5",
|
|
138
|
+
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz",
|
|
139
|
+
"integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg=="
|
|
140
|
+
},
|
|
141
|
+
"node_modules/discord.js": {
|
|
142
|
+
"version": "13.8.0",
|
|
143
|
+
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.0.tgz",
|
|
144
|
+
"integrity": "sha512-EPAA/2VLycYN5wSzavqa4iJ6qj3UtQFtHw5TH/60Fj29ymfEsCQVn//o1mTpwDxzwb+rPIrWhkxKIGGnjfv0Iw==",
|
|
145
|
+
"dependencies": {
|
|
146
|
+
"@discordjs/builders": "^0.14.0",
|
|
147
|
+
"@discordjs/collection": "^0.7.0",
|
|
148
|
+
"@sapphire/async-queue": "^1.3.1",
|
|
149
|
+
"@types/node-fetch": "^2.6.1",
|
|
150
|
+
"@types/ws": "^8.5.3",
|
|
151
|
+
"discord-api-types": "^0.33.3",
|
|
152
|
+
"form-data": "^4.0.0",
|
|
153
|
+
"node-fetch": "^2.6.1",
|
|
154
|
+
"ws": "^8.7.0"
|
|
155
|
+
},
|
|
156
|
+
"engines": {
|
|
157
|
+
"node": ">=16.6.0",
|
|
158
|
+
"npm": ">=7.0.0"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"node_modules/fast-deep-equal": {
|
|
162
|
+
"version": "3.1.3",
|
|
163
|
+
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
|
164
|
+
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
|
165
|
+
},
|
|
166
|
+
"node_modules/form-data": {
|
|
167
|
+
"version": "4.0.0",
|
|
168
|
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
|
169
|
+
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
|
170
|
+
"dependencies": {
|
|
171
|
+
"asynckit": "^0.4.0",
|
|
172
|
+
"combined-stream": "^1.0.8",
|
|
173
|
+
"mime-types": "^2.1.12"
|
|
174
|
+
},
|
|
175
|
+
"engines": {
|
|
176
|
+
"node": ">= 6"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"node_modules/mime-db": {
|
|
180
|
+
"version": "1.52.0",
|
|
181
|
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
182
|
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
|
183
|
+
"engines": {
|
|
184
|
+
"node": ">= 0.6"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"node_modules/mime-types": {
|
|
188
|
+
"version": "2.1.35",
|
|
189
|
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
190
|
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
191
|
+
"dependencies": {
|
|
192
|
+
"mime-db": "1.52.0"
|
|
193
|
+
},
|
|
194
|
+
"engines": {
|
|
195
|
+
"node": ">= 0.6"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"node_modules/node-fetch": {
|
|
199
|
+
"version": "2.6.7",
|
|
200
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
|
201
|
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
|
202
|
+
"dependencies": {
|
|
203
|
+
"whatwg-url": "^5.0.0"
|
|
204
|
+
},
|
|
205
|
+
"engines": {
|
|
206
|
+
"node": "4.x || >=6.0.0"
|
|
207
|
+
},
|
|
208
|
+
"peerDependencies": {
|
|
209
|
+
"encoding": "^0.1.0"
|
|
210
|
+
},
|
|
211
|
+
"peerDependenciesMeta": {
|
|
212
|
+
"encoding": {
|
|
213
|
+
"optional": true
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"node_modules/tr46": {
|
|
218
|
+
"version": "0.0.3",
|
|
219
|
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
220
|
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
|
221
|
+
},
|
|
222
|
+
"node_modules/ts-mixer": {
|
|
223
|
+
"version": "6.0.1",
|
|
224
|
+
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz",
|
|
225
|
+
"integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg=="
|
|
226
|
+
},
|
|
227
|
+
"node_modules/tslib": {
|
|
228
|
+
"version": "2.4.0",
|
|
229
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
|
|
230
|
+
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
|
231
|
+
},
|
|
232
|
+
"node_modules/typescript": {
|
|
233
|
+
"version": "4.7.3",
|
|
234
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
|
|
235
|
+
"integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==",
|
|
236
|
+
"bin": {
|
|
237
|
+
"tsc": "bin/tsc",
|
|
238
|
+
"tsserver": "bin/tsserver"
|
|
239
|
+
},
|
|
240
|
+
"engines": {
|
|
241
|
+
"node": ">=4.2.0"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"node_modules/webidl-conversions": {
|
|
245
|
+
"version": "3.0.1",
|
|
246
|
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
247
|
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
|
248
|
+
},
|
|
249
|
+
"node_modules/whatwg-url": {
|
|
250
|
+
"version": "5.0.0",
|
|
251
|
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
252
|
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
|
253
|
+
"dependencies": {
|
|
254
|
+
"tr46": "~0.0.3",
|
|
255
|
+
"webidl-conversions": "^3.0.0"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"node_modules/ws": {
|
|
259
|
+
"version": "8.8.0",
|
|
260
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz",
|
|
261
|
+
"integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==",
|
|
262
|
+
"engines": {
|
|
263
|
+
"node": ">=10.0.0"
|
|
264
|
+
},
|
|
265
|
+
"peerDependencies": {
|
|
266
|
+
"bufferutil": "^4.0.1",
|
|
267
|
+
"utf-8-validate": "^5.0.2"
|
|
268
|
+
},
|
|
269
|
+
"peerDependenciesMeta": {
|
|
270
|
+
"bufferutil": {
|
|
271
|
+
"optional": true
|
|
272
|
+
},
|
|
273
|
+
"utf-8-validate": {
|
|
274
|
+
"optional": true
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"dependencies": {
|
|
280
|
+
"@discordjs/builders": {
|
|
281
|
+
"version": "0.14.0",
|
|
282
|
+
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz",
|
|
283
|
+
"integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==",
|
|
284
|
+
"requires": {
|
|
285
|
+
"@sapphire/shapeshift": "^3.1.0",
|
|
286
|
+
"@sindresorhus/is": "^4.6.0",
|
|
287
|
+
"discord-api-types": "^0.33.3",
|
|
288
|
+
"fast-deep-equal": "^3.1.3",
|
|
289
|
+
"ts-mixer": "^6.0.1",
|
|
290
|
+
"tslib": "^2.4.0"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"@discordjs/collection": {
|
|
294
|
+
"version": "0.7.0",
|
|
295
|
+
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.7.0.tgz",
|
|
296
|
+
"integrity": "sha512-R5i8Wb8kIcBAFEPLLf7LVBQKBDYUL+ekb23sOgpkpyGT+V4P7V83wTxcsqmX+PbqHt4cEHn053uMWfRqh/Z/nA=="
|
|
297
|
+
},
|
|
298
|
+
"@sapphire/async-queue": {
|
|
299
|
+
"version": "1.3.1",
|
|
300
|
+
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz",
|
|
301
|
+
"integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g=="
|
|
302
|
+
},
|
|
303
|
+
"@sapphire/shapeshift": {
|
|
304
|
+
"version": "3.2.0",
|
|
305
|
+
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.2.0.tgz",
|
|
306
|
+
"integrity": "sha512-asNgE5Ooil2/oGIAj6vZMoUc2ZFED0TGYD7jwvZsjHPQZBEh9ITj94ca4bCgiCR1s2ER/UjzykH+5wE3ebVZnQ=="
|
|
307
|
+
},
|
|
308
|
+
"@sindresorhus/is": {
|
|
309
|
+
"version": "4.6.0",
|
|
310
|
+
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
|
311
|
+
"integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="
|
|
312
|
+
},
|
|
313
|
+
"@types/node": {
|
|
314
|
+
"version": "18.0.0",
|
|
315
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.0.tgz",
|
|
316
|
+
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA=="
|
|
317
|
+
},
|
|
318
|
+
"@types/node-fetch": {
|
|
319
|
+
"version": "2.6.2",
|
|
320
|
+
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz",
|
|
321
|
+
"integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==",
|
|
322
|
+
"requires": {
|
|
323
|
+
"@types/node": "*",
|
|
324
|
+
"form-data": "^3.0.0"
|
|
325
|
+
},
|
|
326
|
+
"dependencies": {
|
|
327
|
+
"form-data": {
|
|
328
|
+
"version": "3.0.1",
|
|
329
|
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
|
|
330
|
+
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
|
|
331
|
+
"requires": {
|
|
332
|
+
"asynckit": "^0.4.0",
|
|
333
|
+
"combined-stream": "^1.0.8",
|
|
334
|
+
"mime-types": "^2.1.12"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
"@types/ws": {
|
|
340
|
+
"version": "8.5.3",
|
|
341
|
+
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz",
|
|
342
|
+
"integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==",
|
|
343
|
+
"requires": {
|
|
344
|
+
"@types/node": "*"
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"asynckit": {
|
|
348
|
+
"version": "0.4.0",
|
|
349
|
+
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
350
|
+
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
|
351
|
+
},
|
|
352
|
+
"colors": {
|
|
353
|
+
"version": "1.4.0",
|
|
354
|
+
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
|
|
355
|
+
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
|
|
356
|
+
},
|
|
357
|
+
"combined-stream": {
|
|
358
|
+
"version": "1.0.8",
|
|
359
|
+
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
|
360
|
+
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
|
361
|
+
"requires": {
|
|
362
|
+
"delayed-stream": "~1.0.0"
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
"delayed-stream": {
|
|
366
|
+
"version": "1.0.0",
|
|
367
|
+
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
|
368
|
+
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
|
369
|
+
},
|
|
370
|
+
"discord-api-types": {
|
|
371
|
+
"version": "0.33.5",
|
|
372
|
+
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz",
|
|
373
|
+
"integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg=="
|
|
374
|
+
},
|
|
375
|
+
"discord.js": {
|
|
376
|
+
"version": "13.8.0",
|
|
377
|
+
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.0.tgz",
|
|
378
|
+
"integrity": "sha512-EPAA/2VLycYN5wSzavqa4iJ6qj3UtQFtHw5TH/60Fj29ymfEsCQVn//o1mTpwDxzwb+rPIrWhkxKIGGnjfv0Iw==",
|
|
379
|
+
"requires": {
|
|
380
|
+
"@discordjs/builders": "^0.14.0",
|
|
381
|
+
"@discordjs/collection": "^0.7.0",
|
|
382
|
+
"@sapphire/async-queue": "^1.3.1",
|
|
383
|
+
"@types/node-fetch": "^2.6.1",
|
|
384
|
+
"@types/ws": "^8.5.3",
|
|
385
|
+
"discord-api-types": "^0.33.3",
|
|
386
|
+
"form-data": "^4.0.0",
|
|
387
|
+
"node-fetch": "^2.6.1",
|
|
388
|
+
"ws": "^8.7.0"
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"fast-deep-equal": {
|
|
392
|
+
"version": "3.1.3",
|
|
393
|
+
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
|
394
|
+
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
|
395
|
+
},
|
|
396
|
+
"form-data": {
|
|
397
|
+
"version": "4.0.0",
|
|
398
|
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
|
399
|
+
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
|
400
|
+
"requires": {
|
|
401
|
+
"asynckit": "^0.4.0",
|
|
402
|
+
"combined-stream": "^1.0.8",
|
|
403
|
+
"mime-types": "^2.1.12"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"mime-db": {
|
|
407
|
+
"version": "1.52.0",
|
|
408
|
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
409
|
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
|
410
|
+
},
|
|
411
|
+
"mime-types": {
|
|
412
|
+
"version": "2.1.35",
|
|
413
|
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
414
|
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
415
|
+
"requires": {
|
|
416
|
+
"mime-db": "1.52.0"
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
"node-fetch": {
|
|
420
|
+
"version": "2.6.7",
|
|
421
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
|
422
|
+
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
|
423
|
+
"requires": {
|
|
424
|
+
"whatwg-url": "^5.0.0"
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
"tr46": {
|
|
428
|
+
"version": "0.0.3",
|
|
429
|
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
430
|
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
|
431
|
+
},
|
|
432
|
+
"ts-mixer": {
|
|
433
|
+
"version": "6.0.1",
|
|
434
|
+
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz",
|
|
435
|
+
"integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg=="
|
|
436
|
+
},
|
|
437
|
+
"tslib": {
|
|
438
|
+
"version": "2.4.0",
|
|
439
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
|
|
440
|
+
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
|
441
|
+
},
|
|
442
|
+
"typescript": {
|
|
443
|
+
"version": "4.7.3",
|
|
444
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
|
|
445
|
+
"integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA=="
|
|
446
|
+
},
|
|
447
|
+
"webidl-conversions": {
|
|
448
|
+
"version": "3.0.1",
|
|
449
|
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
450
|
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
|
451
|
+
},
|
|
452
|
+
"whatwg-url": {
|
|
453
|
+
"version": "5.0.0",
|
|
454
|
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
455
|
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
|
456
|
+
"requires": {
|
|
457
|
+
"tr46": "~0.0.3",
|
|
458
|
+
"webidl-conversions": "^3.0.0"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"ws": {
|
|
462
|
+
"version": "8.8.0",
|
|
463
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.8.0.tgz",
|
|
464
|
+
"integrity": "sha512-JDAgSYQ1ksuwqfChJusw1LSJ8BizJ2e/vVu5Lxjq3YvNJNlROv1ui4i+c/kUUrPheBvQl4c5UbERhTwKa6QBJQ==",
|
|
465
|
+
"requires": {}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= bot-name %>",
|
|
3
|
+
"displayName": "<%= bot-name %>",
|
|
4
|
+
"description": "Please enter a brief description here",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "tsc && node ./dist/src/index.js",
|
|
9
|
+
"watch": "tsc -w",
|
|
10
|
+
"build": "tsc"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"colors": "^1.4.0",
|
|
14
|
+
"discord.js": "^13.8.0",
|
|
15
|
+
"typescript": "^4.7.2"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Client, Intents } from 'discord.js';
|
|
2
|
+
import colors from 'colors';
|
|
3
|
+
import { token } from '../config.json';
|
|
4
|
+
|
|
5
|
+
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
|
|
6
|
+
|
|
7
|
+
// run this code once when your client is ready
|
|
8
|
+
client.once('ready', () => {
|
|
9
|
+
console.log(getTime() + colors.green('Bot is Ready.'));
|
|
10
|
+
console.log(getTime() + colors.green(`Bot is logged in as ${colors.yellow(client.user!.tag)}.`));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// run this code when a new message is created
|
|
14
|
+
client.on('messageCreate', async message => {
|
|
15
|
+
const { content } = message;
|
|
16
|
+
if (content === "!ping") {
|
|
17
|
+
await message.reply("pong!");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// get the current time to get useful log messages
|
|
23
|
+
function getTime() {
|
|
24
|
+
let dateTime = new Date()
|
|
25
|
+
return colors.gray(`[${dateTime.getHours()}:${dateTime.getMinutes()}:${dateTime.getSeconds()}] `);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// login to with your client's token
|
|
29
|
+
client.login(token);
|
|
30
|
+
|
|
31
|
+
// for more information check out the official guide: https://discordjs.guide/creating-your-bot
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"strict": false,
|
|
9
|
+
"noUnusedLocals": true,
|
|
10
|
+
"noImplicitReturns": true,
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"src/**/*.ts",
|
|
19
|
+
"config.json"
|
|
20
|
+
],
|
|
21
|
+
"exclude": [
|
|
22
|
+
"dist",
|
|
23
|
+
"node_modules"
|
|
24
|
+
]
|
|
25
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"outDir": "app",
|
|
8
|
+
"strict": false,
|
|
9
|
+
"noUnusedLocals": true,
|
|
10
|
+
"noImplicitReturns": true,
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"src/**/*.ts",
|
|
19
|
+
"config.json"
|
|
20
|
+
],
|
|
21
|
+
"exclude": [
|
|
22
|
+
"app",
|
|
23
|
+
"node_modules"
|
|
24
|
+
]
|
|
25
|
+
}
|