From 466c82ec25138584e4a3e44b6b11639ddcfd323c Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Fri, 13 Jan 2023 17:33:58 +0100 Subject: [PATCH 1/3] Rename src/main.py -> bot.py --- README.md | 6 +++--- src/main.py => bot.py | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename src/main.py => bot.py (100%) diff --git a/README.md b/README.md index 5a178dc..74a15a2 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ pip install -r requirements.txt - On the last line, replace `TOKEN` with your bot token -- Then, run the `main.py`file: +- Then, run the `bot.py`file: ```sh -python3 main.py +python3 bot.py ``` @@ -22,4 +22,4 @@ python3 main.py 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. -Any use of this bot outside of Linux General is not mine and Bodge's responsability. \ No newline at end of file +Any use of this bot outside of Linux General is not mine and Bodge's responsability. diff --git a/src/main.py b/bot.py similarity index 100% rename from src/main.py rename to bot.py From afa068cf52f9fbad4e67b70558d45881700c4283 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Fri, 13 Jan 2023 17:47:23 +0100 Subject: [PATCH 2/3] Remove psutil dependency --- bot.py | 4 ++-- requirements.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 0c621c1..32c53cf 100644 --- a/bot.py +++ b/bot.py @@ -7,13 +7,13 @@ from discord import app_commands import typing from discord.ext import commands import discord.utils -import psutil import time from sys import platform +BOOT_TIME = time.time() def seconds_elapsed(): - return time.time() - psutil.boot_time() + return time.time() - BOOT_TIME class MyClient(discord.Client): diff --git a/requirements.txt b/requirements.txt index 1f86944..47a3c96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ discord.py==2.1.0 -psutil==5.9.4 From 6e4674953e7ecda0b32dd7b437893fd913e823d5 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Fri, 13 Jan 2023 17:47:58 +0100 Subject: [PATCH 3/3] Get bot token from command line --- README.md | 8 ++++---- bot.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 74a15a2..7dbd7b0 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,18 @@ A bot written for the Linux General Discord Server -### How to run +### Setup - Install the necessary packages: ```sh pip install -r requirements.txt ``` -- On the last line, replace `TOKEN` with your bot token +### Running -- Then, run the `bot.py`file: +- Run the `bot.py`file passing the bot token as argument: ```sh -python3 bot.py +python3 bot.py TOKEN_HERE ``` diff --git a/bot.py b/bot.py index 32c53cf..8fa36be 100644 --- a/bot.py +++ b/bot.py @@ -8,7 +8,7 @@ import typing from discord.ext import commands import discord.utils import time -from sys import platform +import sys BOOT_TIME = time.time() @@ -190,10 +190,10 @@ async def report_message(interaction: discord.Interaction, message: discord.Mess async def status(interaction: discord.Interaction): embed = discord.Embed(title='System Stats') embed.description = f"""Uptime: {seconds_elapsed()} -System: {platform}""" +System: {sys.platform}""" url_view = discord.ui.View() await interaction.response.send_message(embed=embed, view=url_view) client.tree.sync() -client.run('TOKEN') +client.run(sys.argv[1])