/botly/behaviour.py (25f3a070764f761bcd807b8f7986013fd83c7d30) (919 bytes) (mode 100644) (type blob)
#!/usr/bin/env python
"""This class groups by name of events the reactions of the Bot"""
class Behaviour:
"""Behaviour class holds the reaction sorted by event name."""
def __init__(self, reactions, bot):
self.reactions = {}
# We will group reactions based on the event
# they react on.
for reaction in reactions:
ename = reaction.eventName
bot.print("Loading reaction '"
+ reaction.moduleName
+ "' into event table '"
+ ename + "'.")
if not ename in self.reactions:
self.reactions[ename] = []
self.reactions[ename].append(reaction)
def get_reactions(self, eventName):
"""Returns reaction by event name given, or False it none exist."""
if eventName in self.reactions:
return self.reactions[eventName]
return False
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
10175 |
e454a52586f29b8ce8a6799163eac1f875e9ac01 |
LICENSE |
100644 |
blob |
912 |
43cc367ee8608a8760e6665ac29c411d58dc8b99 |
README.md |
040000 |
tree |
- |
66dcfaf2ba5cd5742f36e01d7785daf5113c2107 |
botly |
100644 |
blob |
172 |
3f148ab99d152565c46e51fd45e51030417f7faa |
example.py |
040000 |
tree |
- |
e05b34e00f419ee6a20bf1bb6a0603727b1b4399 |
examplebot |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/detche/Botly
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/detche/Botly
Clone this repository using git:
git clone git://git.rocketgit.com/user/detche/Botly
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main