mirror of
https://github.com/solero/houdini.git
synced 2024-11-14 14:48:21 +00:00
Example plugin
This commit is contained in:
parent
58d886d09d
commit
6529ce0a4a
37
Houdini/Plugins/Example/__init__.py
Normal file
37
Houdini/Plugins/Example/__init__.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from Houdini import Handlers
|
||||||
|
from Houdini.Handlers import XTPacket
|
||||||
|
|
||||||
|
from Houdini.Plugins import IPlugin
|
||||||
|
|
||||||
|
|
||||||
|
class Example(IPlugin):
|
||||||
|
author = "Ben"
|
||||||
|
description = "Example plugin for developers"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
def __init__(self, server):
|
||||||
|
self.server = server
|
||||||
|
|
||||||
|
async def ready(self):
|
||||||
|
self.server.logger.info('Example.ready()')
|
||||||
|
|
||||||
|
async def message_cooling(self, p):
|
||||||
|
print("{}, Message was sent during cooldown".format(p))
|
||||||
|
|
||||||
|
@Handlers.handler(XTPacket('s', 'sm'))
|
||||||
|
@Handlers.cooldown(1, callback=message_cooling)
|
||||||
|
async def handle_send_message(self, p, message: str):
|
||||||
|
print('Do stuff with {}'.format(message))
|
||||||
|
|
||||||
|
# @Commands.command('ping')
|
||||||
|
async def ping(self, p):
|
||||||
|
p.send_xt('cprompt', 'Pong')
|
||||||
|
|
||||||
|
# @Events.on('connected')
|
||||||
|
async def on_connected(self, client):
|
||||||
|
print(client)
|
||||||
|
|
||||||
|
# @Events.on('disconnected')
|
||||||
|
async def on_disconnect(self, client):
|
||||||
|
print(client)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user