mirror of
https://github.com/nichkara/InfinitumBotty.git
synced 2026-06-10 22:26:23 +02:00
Botties Bastelstunde, jetzt in Farbe
This commit is contained in:
47
FaustBot/Modules/BastelObserver.py
Normal file
47
FaustBot/Modules/BastelObserver.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from time import sleep
|
||||
from wikipedia import wikipedia
|
||||
from FaustBot.Communication import Connection
|
||||
from FaustBot.Modules.PrivMsgObserverPrototype import PrivMsgObserverPrototype
|
||||
|
||||
|
||||
class JokeObserver(PrivMsgObserverPrototype):
|
||||
@staticmethod
|
||||
def cmd():
|
||||
"""
|
||||
@name cmd
|
||||
@brief Register the commands to act on
|
||||
|
||||
Args:
|
||||
@param
|
||||
Returns:
|
||||
listener Python list with strings to listen for.
|
||||
"""
|
||||
listener = [".basteln", ".craft"]
|
||||
|
||||
return listener
|
||||
|
||||
@staticmethod
|
||||
def help():
|
||||
return ".basteln - Botty bastelt etwas"
|
||||
|
||||
def update_on_priv_msg(self, data: dict, connection: Connection):
|
||||
"""
|
||||
@name update_on_priv_msg
|
||||
@brief Handle botty's crafting process
|
||||
|
||||
Args:
|
||||
@param self@param data: dict@param connection: Connection
|
||||
Returns:
|
||||
|
||||
"""
|
||||
if data['message'].find('.craft') == -1:
|
||||
return
|
||||
connection.send_back("/me rennt in die Werkstatt!", data)
|
||||
sleep(5)
|
||||
connection.send_back("/me poltert herum!", data)
|
||||
|
||||
# Determine, what Botty has built (random wikipedia article)
|
||||
erdbeerstreusel = wikipedia.random(1)
|
||||
sleep(5)
|
||||
connection.send_back(
|
||||
f"/me kommt zurück und hat {erdbeerstreusel} gebastelt.", data)
|
||||
Reference in New Issue
Block a user