Skip to content

Commit 7a66306

Browse files
committed
Trying to fix kruft
1 parent 555cb58 commit 7a66306

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

bot/bot.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nextcord
22
from nextcord.ext import commands
3-
from shared.config import CHANNEL_ID, DISCORD_TOKEN, GUILD_ID, BOT_STATUS, BOT_NAME
3+
from shared.config import CHANNEL_ID, DISCORD_TOKEN
44

55
# Create an instance of the bot with all intents enabled
66
intents = nextcord.Intents.all()
@@ -33,21 +33,3 @@ async def update_message(content):
3333
if section and not section.isspace():
3434
await channel.send(f"## {section}")
3535

36-
@bot.event
37-
async def on_ready():
38-
"""
39-
An event listener for when the bot is ready and operational.
40-
41-
Prints a message to the console to indicate that the bot is ready.
42-
"""
43-
print(f'{BOT_NAME} has connected to Discord!')
44-
# Mark the bot as "up" when it is online
45-
BOT_STATUS.labels(bot_name=BOT_NAME).set(1)
46-
47-
48-
@bot.event
49-
async def on_disconnect():
50-
print(f'{BOT_NAME} has disconnected from Discord!')
51-
# Mark the bot as "down" when it is offline
52-
BOT_STATUS.labels(bot_name=BOT_NAME).set(0)
53-

main.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import threading
22
from bot.bot import bot
33
from web.app import app
4-
from shared.config import DISCORD_TOKEN, ENABLE_LOGGING
4+
from shared.config import DISCORD_TOKEN, ENABLE_LOGGING, BOT_STATUS, BOT_NAME
55
from shared.logger import setup_logging # Importing from your logger module
66
from prometheus_client import start_http_server
77
import time
@@ -15,6 +15,23 @@ def start_prometheus_server():
1515
def run():
1616
app.run(port=9999)
1717

18+
@bot.event
19+
async def on_ready():
20+
"""
21+
An event listener for when the bot is ready and operational.
22+
23+
Prints a message to the console to indicate that the bot is ready.
24+
"""
25+
print(f'{BOT_NAME} has connected to Discord!')
26+
# Mark the bot as "up" when it is online
27+
BOT_STATUS.labels(bot_name=BOT_NAME).set(1)
28+
29+
30+
@bot.event
31+
async def on_disconnect():
32+
print(f'{BOT_NAME} has disconnected from Discord!')
33+
# Mark the bot as "down" when it is offline
34+
BOT_STATUS.labels(bot_name=BOT_NAME).set(0)
1835

1936
if __name__ == '__main__':
2037
if ENABLE_LOGGING:

0 commit comments

Comments
 (0)