Updated Dockerfiles and implemented API endpoint
This commit is contained in:
35
code/bot.py
Normal file
35
code/bot.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import hikari
|
||||
import lightbulb
|
||||
import logging
|
||||
import configparser
|
||||
from module.rainer_board import rainerSpruche
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('config.ini')
|
||||
|
||||
spruchDatei = config.get('GENERAL','spruchDatei')
|
||||
nameDatei = config.get('GENERAL', 'nameDatei')
|
||||
botToken = config.get('BOT','token')
|
||||
|
||||
bot = lightbulb.BotApp(
|
||||
token=botToken
|
||||
)
|
||||
|
||||
@bot.listen(hikari.StartedEvent)
|
||||
async def onStarted(event):
|
||||
print('Der Bot wurde gestartet!')
|
||||
|
||||
@bot.listen(hikari.StoppedEvent)
|
||||
async def onStopped(event):
|
||||
print('Der Bot wurde gestoppt!')
|
||||
|
||||
@bot.command
|
||||
@lightbulb.command('haider', 'Meddld nen krassen Spruch raus etzadla!')
|
||||
@lightbulb.implements(lightbulb.SlashCommand)
|
||||
async def haider(ctx):
|
||||
rainer = rainerSpruche(spruchDatei, nameDatei)
|
||||
spruch = rainer.randomSpruch()
|
||||
name = rainer.randomName()
|
||||
await ctx.respond(name + ' sagt: ' + '\n' + spruch)
|
||||
|
||||
bot.run()
|
||||
Reference in New Issue
Block a user