Skip to content

Commit 555cb58

Browse files
committed
move things into right area and dump old shit
1 parent 925eeaa commit 555cb58

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

bot/bot.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import nextcord
22
from nextcord.ext import commands
3-
from shared.config import CHANNEL_ID, DISCORD_TOKEN, GUILD_ID
4-
from main import BOT_STATUS, bot_name
3+
from shared.config import CHANNEL_ID, DISCORD_TOKEN, GUILD_ID, BOT_STATUS, BOT_NAME
54

65
# Create an instance of the bot with all intents enabled
76
intents = nextcord.Intents.all()
@@ -41,18 +40,14 @@ async def on_ready():
4140
4241
Prints a message to the console to indicate that the bot is ready.
4342
"""
44-
print(f'{bot_name} has connected to Discord!')
43+
print(f'{BOT_NAME} has connected to Discord!')
4544
# Mark the bot as "up" when it is online
46-
BOT_STATUS.labels(bot_name=bot_name).set(1)
45+
BOT_STATUS.labels(bot_name=BOT_NAME).set(1)
4746

4847

4948
@bot.event
5049
async def on_disconnect():
51-
print(f'{bot_name} has disconnected from Discord!')
50+
print(f'{BOT_NAME} has disconnected from Discord!')
5251
# Mark the bot as "down" when it is offline
53-
BOT_STATUS.labels(bot_name=bot_name).set(0)
52+
BOT_STATUS.labels(bot_name=BOT_NAME).set(0)
5453

55-
if __name__ == '__main__':
56-
57-
# Run the bot with the specified token
58-
bot.run(DISCORD_TOKEN)

main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
from web.app import app
44
from shared.config import DISCORD_TOKEN, ENABLE_LOGGING
55
from shared.logger import setup_logging # Importing from your logger module
6-
from prometheus_client import start_http_server, Gauge
6+
from prometheus_client import start_http_server
77
import time
88

9-
BOT_STATUS = Gauge('discord_bot_status', 'Status of the Discord bot', ['bot_name'])
10-
bot_name = 'Kernel'
119

1210
def start_prometheus_server():
1311
# Start a Prometheus HTTP server on port 8000
@@ -31,5 +29,4 @@ def run():
3129
bot.load_extension('bot.news_feed')
3230
# bot.load_extension('bot.moderation') Turning off because it's not working
3331
# Start the bot
34-
start_prometheus_server()
3532
bot.run(DISCORD_TOKEN)

shared/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from dotenv import load_dotenv
22
import os
3+
from prometheus_client import Gauge
34

45
GUILD_ID = 930170875049820181
56
CHANNEL_ID = 978644045519802378 # This will be imported in both bot and web modules
@@ -19,3 +20,5 @@
1920
"https://www.wired.com/feed/rss",
2021
]
2122

23+
BOT_STATUS = Gauge('discord_bot_status', 'Status of the Discord bot', ['bot_name'])
24+
BOT_NAME = 'Kernel'

0 commit comments

Comments
 (0)