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