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.17",
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": "^16.5.0",
46
- "eslint": "^9.25.1",
47
- "typescript": "^5.8.3",
48
- "typescript-eslint": "^8.31.1",
49
- "vitest": "^3.1.2",
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.0"
51
+ "yeoman-test": "^10.1.1"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@rollup/rollup-linux-x64-gnu": "^4.40.1"
54
+ "@rollup/rollup-linux-x64-gnu": "^4.48.1"
55
55
  }
56
56
  }
@@ -8,6 +8,6 @@
8
8
  "start": "node ./src/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "discord.js": "^14.19.2"
11
+ "discord.js": "^14.22.1"
12
12
  }
13
13
  }
@@ -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
- client = discord.Client(intents=intents)
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
- @client.event
10
- async def on_ready():
11
- print(f'Bot is logged in as {client.user}')
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
- @client.event
14
- async def on_message(message):
15
- if message.author == client.user:
16
- return
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
- if message.content.startswith('!ping'):
19
- await message.channel.send('Pong!')
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.4.0
1
+ discord.py ~= 2.6.2
@@ -10,7 +10,7 @@
10
10
  "build": "tsc"
11
11
  },
12
12
  "dependencies": {
13
- "discord.js": "^14.19.2",
14
- "typescript": "^5.8.3"
13
+ "discord.js": "^14.22.1",
14
+ "typescript": "^5.9.2"
15
15
  }
16
16
  }