Skip to content

Commit

Permalink
Release v1.1.0
Browse files Browse the repository at this point in the history
# v1.1.0

Change IP logging from Local computer interface IP to using the service 'https://httpbin.org' to get the Public IP of the computer.
  • Loading branch information
redtrillix committed Mar 31, 2024
1 parent 66749e1 commit ee99f56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

# v1.1.0
Change IP logging from Local computer interface IP to using the service 'https://httpbin.org' to get the Public IP of the computer.

# v1.0.0 - Initial Full Release
Added psutil dependency for CPU and Memory logging in Discord message.
Added socket dependency for Hostname and IP logging in Discord message.
Expand Down
12 changes: 8 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Version: 1.0.0
## Version: 1.1.0
## License: https://github.com/redtrillix/DiscordComputerStatus/raw/main/LICENSE
## Git Repository: https://github.com/redtrillix/DiscordComputerStatus
## Changelog: https://github.com/redtrillix/DiscordComputerStatus/blob/main/CHANGELOG.txt
Expand All @@ -10,6 +10,7 @@
from datetime import datetime
import socket
import psutil
import requests

# Discord bot token
TOKEN = 'your_bot_token_here'
Expand All @@ -26,8 +27,11 @@
# Get the hostname
hostname = socket.gethostname()

# Get the IP address
ip_address = socket.gethostbyname(hostname)
# Get the public IP address
try:
public_ip = requests.get('https://httpbin.org/ip').json()['origin']
except Exception as e:
public_ip = "Unavailable"

# Get CPU and memory usage
cpu_usage = psutil.cpu_percent()
Expand All @@ -37,7 +41,7 @@
MESSAGE = f"**System Notification:**\n\n"
MESSAGE += f"🔔 System turned on at {current_time}.\n"
MESSAGE += f"🖥️ Hostname: {hostname}\n"
MESSAGE += f"🌐 IP Address: {ip_address}\n"
MESSAGE += f"🌐 Public IP Address: {public_ip}\n"
MESSAGE += f"💻 CPU Usage: {cpu_usage}%\n"
MESSAGE += f"🧠 Memory Usage: {memory_usage}%\n\n"
MESSAGE += "**Services Running:**\n\n"
Expand Down

0 comments on commit ee99f56

Please sign in to comment.