generator-discord 1.3.17 → 1.3.19
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-discord",
|
|
3
3
|
"displayName": "Generator-Discord",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./app/index.js",
|
|
7
7
|
"description": "Create a basic Discord-Bot, supporting many programming languages.",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"yeoman-generator": "^7.5.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"dotenv": "^
|
|
46
|
-
"eslint": "^9.
|
|
47
|
-
"typescript": "^5.
|
|
48
|
-
"typescript-eslint": "^8.
|
|
49
|
-
"vitest": "^3.
|
|
45
|
+
"dotenv": "^17.2.1",
|
|
46
|
+
"eslint": "^9.34.0",
|
|
47
|
+
"typescript": "^5.9.2",
|
|
48
|
+
"typescript-eslint": "^8.40.0",
|
|
49
|
+
"vitest": "^3.2.4",
|
|
50
50
|
"yeoman-environment": "^4.4.3",
|
|
51
|
-
"yeoman-test": "^10.1.
|
|
51
|
+
"yeoman-test": "^10.1.1"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@rollup/rollup-linux-x64-gnu": "^4.
|
|
54
|
+
"@rollup/rollup-linux-x64-gnu": "^4.48.1"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/templates/python/main.py
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import discord
|
|
2
2
|
from config import TOKEN
|
|
3
3
|
|
|
4
|
-
intents = discord.Intents.default()
|
|
5
|
-
intents.message_content = True
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
prefix = '!'
|
|
6
|
+
|
|
7
|
+
class DefaultClient(discord.Client):
|
|
8
|
+
async def on_ready(self):
|
|
9
|
+
print(f'Logged in as {self.user} (ID: {self.user.id})')
|
|
10
|
+
print('------')
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
async def on_message(self, message):
|
|
13
|
+
# we do not want the bot to reply to itself
|
|
14
|
+
if message.author.id == self.user.id:
|
|
15
|
+
return
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
if message.content.startswith(prefix):
|
|
18
|
+
command = message.content[len(prefix):].split()[0]
|
|
19
|
+
args = message.content[len(prefix) + len(command):].strip()
|
|
20
|
+
|
|
21
|
+
if command == 'ping':
|
|
22
|
+
await message.channel.send('Pong!')
|
|
23
|
+
elif command == 'say':
|
|
24
|
+
# Get the message after the command
|
|
25
|
+
message_to_send = args
|
|
26
|
+
if message_to_send:
|
|
27
|
+
await message.channel.send(message_to_send)
|
|
28
|
+
else:
|
|
29
|
+
await message.channel.send('Please provide a message to send.')
|
|
30
|
+
elif command == 'help':
|
|
31
|
+
await message.channel.send('Available commands: !ping, !say <message>, !help')
|
|
17
32
|
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
intents = discord.Intents.default()
|
|
34
|
+
intents.message_content = True
|
|
20
35
|
|
|
36
|
+
client = DefaultClient(intents=intents)
|
|
21
37
|
client.run(TOKEN)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
discord.py ~= 2.
|
|
1
|
+
discord.py ~= 2.6.2
|