Rifat Azad commited on
Commit
a7c61bf
·
1 Parent(s): 9d93df9

get ip command

Browse files
Files changed (1) hide show
  1. pydvpl_bot.py +15 -3
pydvpl_bot.py CHANGED
@@ -4,6 +4,8 @@ import json
4
  import asyncio
5
  import psutil
6
  import discord
 
 
7
  from dotenv import load_dotenv
8
  from discord.ext import commands, tasks
9
  from pydvpl.dvpl import compress_dvpl, decompress_dvpl, __LZ4_VERSION__
@@ -23,7 +25,7 @@ load_dotenv()
23
  # DEFINES ------------------------------------------------------ START
24
 
25
 
26
- BOT_VERSION = '1.2.4'
27
 
28
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
29
 
@@ -509,8 +511,6 @@ async def version(ctx):
509
  # FUNCTION ------------------------------------------------------ SPLIT
510
 
511
 
512
- from datetime import datetime
513
-
514
  @bot.hybrid_command(help="Shows the current date and time.")
515
  async def clock(ctx):
516
  # Get the current date and time
@@ -521,6 +521,18 @@ async def clock(ctx):
521
  await ctx.send(f"Current date and time: `{formatted_now}`")
522
 
523
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  # UTILITY USER_CMD ------------------------------------------------------ END
525
 
526
 
 
4
  import asyncio
5
  import psutil
6
  import discord
7
+ import requests
8
+ from datetime import datetime
9
  from dotenv import load_dotenv
10
  from discord.ext import commands, tasks
11
  from pydvpl.dvpl import compress_dvpl, decompress_dvpl, __LZ4_VERSION__
 
25
  # DEFINES ------------------------------------------------------ START
26
 
27
 
28
+ BOT_VERSION = '1.2.5'
29
 
30
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
31
 
 
511
  # FUNCTION ------------------------------------------------------ SPLIT
512
 
513
 
 
 
514
  @bot.hybrid_command(help="Shows the current date and time.")
515
  async def clock(ctx):
516
  # Get the current date and time
 
521
  await ctx.send(f"Current date and time: `{formatted_now}`")
522
 
523
 
524
+ # FUNCTION ------------------------------------------------------ SPLIT
525
+
526
+
527
+ @bot.command()
528
+ async def ip(ctx):
529
+ response = requests.get('https://api.ipify.org')
530
+ if response.status_code == 200:
531
+ await ctx.send(f'Your IP address is: `{response.text}`')
532
+ else:
533
+ await ctx.send('Failed to fetch IP address.')
534
+
535
+
536
  # UTILITY USER_CMD ------------------------------------------------------ END
537
 
538