Edit bot_core and makefile

This commit is contained in:
2025-11-21 12:51:32 -07:00
parent a72e4daeb2
commit 73c95f8019
2 changed files with 14 additions and 1 deletions

View File

@@ -2,4 +2,4 @@ compose_up:
docker compose up --build docker compose up --build
run: run:
python src/bot_core.py discord.token 477298331777761280 1441505246818996445 python src/bot_core.py database.ini discord.token 477298331777761280 1441505246818996445

View File

@@ -3,10 +3,13 @@
import argparse import argparse
import discord import discord
from discord.ext import commands from discord.ext import commands
import helper.db_helper
CONTRASTELLAR = 181187505448681472 CONTRASTELLAR = 181187505448681472
VERYBADSTAR_PL = 1439484001751404554 VERYBADSTAR_PL = 1439484001751404554
DATABASE_CONN = helper.db_helper.DBHelper = None
# instance variables # instance variables
larboard = 0 larboard = 0
active_guild = 0 active_guild = 0
@@ -24,6 +27,7 @@ client = commands.Bot(command_prefix='!', intents=intents)
# parser init # parser init
parser: argparse.ArgumentParser = argparse.ArgumentParser(prog='very bad core', parser: argparse.ArgumentParser = argparse.ArgumentParser(prog='very bad core',
description='very bad bot core') description='very bad bot core')
parser.add_argument('database')
parser.add_argument('token') parser.add_argument('token')
parser.add_argument('guild_id') parser.add_argument('guild_id')
parser.add_argument('channel_id') parser.add_argument('channel_id')
@@ -37,15 +41,22 @@ async def on_ready():
print(f'{client.user} has connected.') print(f'{client.user} has connected.')
print(f'we are using the guild {args.guild_id} and channel {args.channel_id}') print(f'we are using the guild {args.guild_id} and channel {args.channel_id}')
@client.tree.command() @client.tree.command()
async def ping(interaction: discord.Interaction): async def ping(interaction: discord.Interaction):
await interaction.response.send_message('go fuck yourself (bot is running)') await interaction.response.send_message('go fuck yourself (bot is running)')
return return
@client.event @client.event
async def on_reaction_add(react: discord.Reaction, user: discord.User): async def on_reaction_add(react: discord.Reaction, user: discord.User):
message: discord.Message = react.message message: discord.Message = react.message
reaction: discord.Reaction = react.emoji reaction: discord.Reaction = react.emoji
message_uid: int = message.id
if reaction != VERYBADSTAR_PL: if reaction != VERYBADSTAR_PL:
print(f'disregarding reaction!') print(f'disregarding reaction!')
return return
@@ -57,6 +68,8 @@ async def on_reaction_add(react: discord.Reaction, user: discord.User):
# runtime lines # runtime lines
args: argparse.Namespace = parser.parse_args() args: argparse.Namespace = parser.parse_args()
DATABASE_CONN = helper.db_helper.DBHelper(args.database)
TOKEN: str = open(args.token, encoding='utf-8').read() TOKEN: str = open(args.token, encoding='utf-8').read()
client.run(TOKEN) client.run(TOKEN)