generator-discord 1.2.1 → 1.2.2

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.2.1",
4
+ "version": "1.2.2",
5
5
  "main": "./app/index.js",
6
6
  "description": "Yeoman generator for Discord.js",
7
7
  "keywords": [
@@ -14,7 +14,8 @@
14
14
  "build": "tsc",
15
15
  "watch": "tsc -w",
16
16
  "test": "vitest run",
17
- "debug": "npx --node-arg=--inspect yo discord"
17
+ "debug": "npx --node-arg=--inspect yo discord",
18
+ "clean": "npx rimraf app && npx rimraf node_modules"
18
19
  },
19
20
  "files": [
20
21
  "app",
@@ -34,14 +35,12 @@
34
35
  },
35
36
  "homepage": "https://github.com/emilkrebs/Generator-Discord",
36
37
  "dependencies": {
37
- "typescript": "^4.7.2",
38
- "yeoman-generator": "^5.6.1"
38
+ "typescript": "^5.1.6",
39
+ "yeoman-generator": "^5.9.0"
39
40
  },
40
41
  "devDependencies": {
41
- "@types/yeoman-generator": "^5.2.10",
42
- "@types/yeoman-test": "~4.0.3",
43
- "yeoman-test": "~7.3.0",
44
- "dotenv": "^16.0.3",
45
- "vitest": "^0.29.2"
42
+ "dotenv": "^16.3.1",
43
+ "vitest": "^0.34.1",
44
+ "yeoman-test": "^7.4.0"
46
45
  }
47
46
  }
@@ -1,21 +1,20 @@
1
1
  import discord
2
- from discord.ext import commands
3
2
 
4
- # Define bot prefix and create bot instance
5
- bot_prefix = "!"
6
- bot = commands.Bot(command_prefix=bot_prefix)
3
+ intents = discord.Intents.default()
4
+ intents.message_content = True
7
5
 
8
- # Define bot events
9
- @bot.event
6
+ client = discord.Client(intents=intents)
7
+
8
+ @client.event
10
9
  async def on_ready():
11
- print(f"Logged in as {bot.user.name} ({bot.user.id})")
10
+ print(f'Bot is logged in as {client.user}')
12
11
 
13
- # Define bot commands
14
- @bot.command()
15
- async def ping(ctx):
16
- await ctx.send("Pong!")
12
+ @client.event
13
+ async def on_message(message):
14
+ if message.author == client.user:
15
+ return
17
16
 
18
- # Run bot with bot token
19
- bot.run("<%= bot-token %>")
17
+ if message.content.startswith('!ping'):
18
+ await message.channel.send('Pong!')
20
19
 
21
- # For more information on how to use discord.py, visit https://discordpy.readthedocs.io/en/latest/
20
+ client.run('<%= bot-token %>')
@@ -57,23 +57,22 @@ const CONFIG_JSON_EXPECTED = normilizeEOL(`{
57
57
  }`);
58
58
 
59
59
  const BOT_PY_EXPECTED = normilizeEOL(`import discord
60
- from discord.ext import commands
61
60
 
62
- # Define bot prefix and create bot instance
63
- bot_prefix = "!"
64
- bot = commands.Bot(command_prefix=bot_prefix)
61
+ intents = discord.Intents.default()
62
+ intents.message_content = True
65
63
 
66
- # Define bot events
67
- @bot.event
64
+ client = discord.Client(intents=intents)
65
+
66
+ @client.event
68
67
  async def on_ready():
69
- print(f"Logged in as {bot.user.name} ({bot.user.id})")
68
+ print(f'Bot is logged in as {client.user}')
70
69
 
71
- # Define bot commands
72
- @bot.command()
73
- async def ping(ctx):
74
- await ctx.send("Pong!")
70
+ @client.event
71
+ async def on_message(message):
72
+ if message.author == client.user:
73
+ return
75
74
 
76
- # Run bot with bot token
77
- bot.run("xxxx")
75
+ if message.content.startswith('!ping'):
76
+ await message.channel.send('Pong!')
78
77
 
79
- # For more information on how to use discord.py, visit https://discordpy.readthedocs.io/en/latest/`);
78
+ client.run('xxxx')`);