Rifat Azad commited on
Commit
0712efd
β€’
1 Parent(s): b5f3a1a
Files changed (2) hide show
  1. README.md +3 -3
  2. pydvpl_bot.py +10 -6
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: PyDVPL Discord Bot
3
- emoji: 🌍
4
- colorFrom: pink
5
- colorTo: indigo
6
  sdk: docker
7
  pinned: false
8
  ---
 
1
  ---
2
  title: PyDVPL Discord Bot
3
+ emoji: 🐍
4
+ colorFrom: blue
5
+ colorTo: yellow
6
  sdk: docker
7
  pinned: false
8
  ---
pydvpl_bot.py CHANGED
@@ -36,7 +36,7 @@ load_dotenv()
36
  # DEFINES ------------------------------------------------------ START
37
 
38
 
39
- BOT_VERSION = '1.4.2'
40
 
41
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
42
 
@@ -447,11 +447,13 @@ async def ping(ctx):
447
  # FUNCTION ------------------------------------------------------ SPLIT
448
 
449
 
450
- @bot.hybrid_command()
451
  async def pinger(ctx, target):
452
  try:
453
  # Attempt to resolve the target to an IP address
454
  ip_address = socket.gethostbyname(target)
 
 
455
 
456
  # Create a socket object
457
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -477,6 +479,7 @@ async def pinger(ctx, target):
477
  color=discord.Color.green()
478
  )
479
  embed.add_field(name="Target", value=target, inline=False)
 
480
  embed.add_field(name="Status", value="Successful 🟒", inline=False)
481
  embed.add_field(name="Latency", value=f"{rtt:.2f}ms", inline=False)
482
 
@@ -484,7 +487,7 @@ async def pinger(ctx, target):
484
  embed.timestamp = ctx.message.created_at
485
 
486
  # Send the embedded message
487
- await ctx.send(embed=embed)
488
 
489
  except socket.gaierror:
490
  # Create an embedded message for resolution error
@@ -495,7 +498,8 @@ async def pinger(ctx, target):
495
  )
496
  embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.display_avatar.url if ctx.author.display_avatar else discord.Embed.Empty)
497
  embed.timestamp = ctx.message.created_at
498
- await ctx.send(embed=embed)
 
499
  except socket.error:
500
  # Create an embedded message for unreachable error
501
  embed = discord.Embed(
@@ -505,8 +509,8 @@ async def pinger(ctx, target):
505
  )
506
  embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.display_avatar.url if ctx.author.display_avatar else discord.Embed.Empty)
507
  embed.timestamp = ctx.message.created_at
508
- await ctx.send(embed=embed)
509
-
510
 
511
 
512
 
 
36
  # DEFINES ------------------------------------------------------ START
37
 
38
 
39
+ BOT_VERSION = '1.4.3'
40
 
41
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
42
 
 
447
  # FUNCTION ------------------------------------------------------ SPLIT
448
 
449
 
450
+ @bot.hybrid_command(help="Pings domain names and ip addresses.")
451
  async def pinger(ctx, target):
452
  try:
453
  # Attempt to resolve the target to an IP address
454
  ip_address = socket.gethostbyname(target)
455
+
456
+ msg = await ctx.reply("Pinging...")
457
 
458
  # Create a socket object
459
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
479
  color=discord.Color.green()
480
  )
481
  embed.add_field(name="Target", value=target, inline=False)
482
+ embed.add_field(name="IP Address", value=ip_address, inline=False) # Add IP address field
483
  embed.add_field(name="Status", value="Successful 🟒", inline=False)
484
  embed.add_field(name="Latency", value=f"{rtt:.2f}ms", inline=False)
485
 
 
487
  embed.timestamp = ctx.message.created_at
488
 
489
  # Send the embedded message
490
+ await msg.edit(content=None, embed=embed)
491
 
492
  except socket.gaierror:
493
  # Create an embedded message for resolution error
 
498
  )
499
  embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.display_avatar.url if ctx.author.display_avatar else discord.Embed.Empty)
500
  embed.timestamp = ctx.message.created_at
501
+
502
+ await msg.edit(content=None, embed=embed)
503
  except socket.error:
504
  # Create an embedded message for unreachable error
505
  embed = discord.Embed(
 
509
  )
510
  embed.set_footer(text=f"Requested by {ctx.author.display_name}", icon_url=ctx.author.display_avatar.url if ctx.author.display_avatar else discord.Embed.Empty)
511
  embed.timestamp = ctx.message.created_at
512
+
513
+ await msg.edit(content=None, embed=embed)
514
 
515
 
516