|
1 | 1 | import nextcord |
2 | 2 | from nextcord.ext import commands |
3 | 3 | from shared.config import CHANNEL_ID, DISCORD_TOKEN, GUILD_ID |
4 | | -from prometheus_client import start_http_server, Gauge |
5 | | -import time |
6 | | - |
7 | | -BOT_STATUS = Gauge('discord_bot_status', 'Status of the Discord bot', ['bot_name']) |
8 | | -bot_name = 'Kernel' |
| 4 | +from main import BOT_STATUS, bot_name |
9 | 5 |
|
10 | 6 | # Create an instance of the bot with all intents enabled |
11 | 7 | intents = nextcord.Intents.all() |
12 | 8 | bot = commands.Bot(command_prefix="!", intents=intents) |
13 | 9 |
|
14 | | - |
15 | 10 | async def clear_channel(channel): |
16 | 11 | """ |
17 | 12 | Clears all messages from the given channel. |
@@ -50,20 +45,13 @@ async def on_ready(): |
50 | 45 | # Mark the bot as "up" when it is online |
51 | 46 | BOT_STATUS.labels(bot_name=bot_name).set(1) |
52 | 47 |
|
53 | | -# Importing slash commands and context menus |
54 | | -# from . import slash_commands, context_menus |
55 | 48 |
|
56 | 49 | @bot.event |
57 | 50 | async def on_disconnect(): |
58 | 51 | print(f'{bot_name} has disconnected from Discord!') |
59 | 52 | # Mark the bot as "down" when it is offline |
60 | 53 | BOT_STATUS.labels(bot_name=bot_name).set(0) |
61 | 54 |
|
62 | | -def start_prometheus_server(): |
63 | | - # Start a Prometheus HTTP server on port 8000 |
64 | | - start_http_server(8000, addr='0.0.0.0') |
65 | | - print("Prometheus server started on port 8000") |
66 | | - |
67 | 55 | if __name__ == '__main__': |
68 | 56 |
|
69 | 57 | # Run the bot with the specified token |
|
0 commit comments