Compare commits

..

4 Commits

Author SHA1 Message Date
Joca 58adc111b5 Merge pull request 'Minor cleanup' (#1) from BodgeMaster/os-release-bot:master into master
Reviewed-on: #1
2023-01-13 16:54:15 +00:00
BodgeMaster 6e4674953e Get bot token from command line 2023-01-13 17:50:53 +01:00
BodgeMaster afa068cf52 Remove psutil dependency 2023-01-13 17:47:23 +01:00
BodgeMaster 466c82ec25 Rename src/main.py -> bot.py 2023-01-13 17:33:58 +01:00
3 changed files with 10 additions and 11 deletions

View File

@ -2,18 +2,18 @@
A bot written for the Linux General Discord Server A bot written for the Linux General Discord Server
### How to run ### Setup
- Install the necessary packages: - Install the necessary packages:
```sh ```sh
pip install -r requirements.txt pip install -r requirements.txt
``` ```
- On the last line, replace `TOKEN` with your bot token ### Running
- Then, run the `main.py`file: - Run the `bot.py`file passing the bot token as argument:
```sh ```sh
python3 main.py python3 bot.py TOKEN_HERE
``` ```
@ -22,4 +22,4 @@ python3 main.py
As this bot is made for one discord server, most things on it are hardcoded. As this bot is made for one discord server, most things on it are hardcoded.
For this bot to work, you might need to replace a big part of the code. For this bot to work, you might need to replace a big part of the code.
Any use of this bot outside of Linux General is not mine and Bodge's responsability. Any use of this bot outside of Linux General is not mine and Bodge's responsability.

View File

@ -7,13 +7,13 @@ from discord import app_commands
import typing import typing
from discord.ext import commands from discord.ext import commands
import discord.utils import discord.utils
import psutil
import time import time
from sys import platform import sys
BOOT_TIME = time.time()
def seconds_elapsed(): def seconds_elapsed():
return time.time() - psutil.boot_time() return time.time() - BOOT_TIME
class MyClient(discord.Client): class MyClient(discord.Client):
@ -190,10 +190,10 @@ async def report_message(interaction: discord.Interaction, message: discord.Mess
async def status(interaction: discord.Interaction): async def status(interaction: discord.Interaction):
embed = discord.Embed(title='System Stats') embed = discord.Embed(title='System Stats')
embed.description = f"""Uptime: {seconds_elapsed()} embed.description = f"""Uptime: {seconds_elapsed()}
System: {platform}""" System: {sys.platform}"""
url_view = discord.ui.View() url_view = discord.ui.View()
await interaction.response.send_message(embed=embed, view=url_view) await interaction.response.send_message(embed=embed, view=url_view)
client.tree.sync() client.tree.sync()
client.run('TOKEN') client.run(sys.argv[1])

View File

@ -1,2 +1 @@
discord.py==2.1.0 discord.py==2.1.0
psutil==5.9.4