List of commits:
Subject Hash Author Date (UTC)
Fixed reaction on discord reactions. 8ee16b5e61d096d1905643cec4da05e7714ed75c Detche 2016-11-29 16:41:56
Fixed log error on leave(). cde179a63badbfdfd17a345886214e1d2b0a1e54 Detche 2016-11-29 15:44:53
Bot now prints in a log file if given at initialization e13bd3dbb86d1bb6f072f751412e89d444d870f3 Detche 2016-11-29 15:38:18
Updated example. e95d1599676ae10b950b2c069e666060005627cf Detche 2016-11-13 19:52:41
Added scheduler to task core. Modified comm for new event. ed51d5d18684dabdb17675294727ad5e8b8af454 Detche 2016-11-13 19:44:05
Started adding possibility to save in database. cf28a7731335cd1ffd2ebd03cc2e890c25e1c64b Detche 2016-11-13 19:43:21
Changed db interface and users/groups models. d0fdf8873a107c44d6acbef5cbffc869461d9aab Detche 2016-11-03 15:22:10
Changed UserId from element to attribute. 5407592cba9e7488519e069927a8ffb9ed32fdf6 Detche 2016-11-02 15:02:30
Added tasks system. 13bbf9857a0a61d5e2b0fd9483f5efd235cbd4f2 Detche 2016-11-02 14:58:20
Modified Knowledge process. Fixed indent 28e52095a297cbb0e6b9b6d799bb80ebe52828c1 Detche 2016-10-23 12:11:30
Updated README 8e298151286ec3cb4df29633aaca90fc871f2e80 Detche 2016-10-23 10:10:45
Update README.rst 7965df28cbef557fd3819919b4d44f0733dcecf0 Guillaume 2016-10-23 00:06:05
Added README page 8339ac5b13803b026dbfc5edd77fa50a24a70ecb Detche 2016-10-22 23:47:05
Added comments to sources. ce6491ef1337ea34d33b7e4ede0eb9f634e7ab1a Detche 2016-10-22 23:32:26
Added examples. Modified reaction class to add triggers. 545a35d1c5bb36e1b4e4d818b0e6a8f6642a222f Detche 2016-10-22 20:56:54
Initial commit 2cd79df6224290a994b1453f0327740816b0f632 Detche 2016-10-21 16:21:02
Commit 8ee16b5e61d096d1905643cec4da05e7714ed75c - Fixed reaction on discord reactions.
Author: Detche
Author date (UTC): 2016-11-29 16:41
Committer name: Detche
Committer date (UTC): 2016-11-29 16:41
Parent(s): cde179a63badbfdfd17a345886214e1d2b0a1e54
Signing key:
Tree: 9e5b57beabd6eecc21760e349449695f48f4ddaa
File Lines added Lines deleted
botly/reaction.py 2 1
botly/trigger.py 11 10
File botly/reaction.py changed (mode: 100644) (index 4c0e2c3..3bcc62a)
... ... class ReactionBase:
102 102 elif 'reaction' in self.eventName: elif 'reaction' in self.eventName:
103 103 self.reaction = eventInfo['reaction'] self.reaction = eventInfo['reaction']
104 104 self.user = eventInfo['user'] self.user = eventInfo['user']
105
105 self.channel = self.reaction.message.channel
106 self.author = self.reaction.message.author
106 107
107 108 def load_reactions(bot, reactionsParent): def load_reactions(bot, reactionsParent):
108 109 """Function that loads reactions from given parent module directory.""" """Function that loads reactions from given parent module directory."""
File botly/trigger.py changed (mode: 100644) (index 049d3b0..cbaf9c0)
... ... class Trigger:
38 38 assert eventName != 'on_ready', \ assert eventName != 'on_ready', \
39 39 'author not supported for on_ready event.' 'author not supported for on_ready event.'
40 40
41 # TODO: add possibility to react on reactions
41 # TODO: add possibility to react on reactions with regular conditions
42 # (for now, can only trigger on that based on adv_condition)
42 43
43 44 condition = [] condition = []
44 45 condition.append(variable) condition.append(variable)
 
... ... class Trigger:
68 69 assert isinstance(value, bool), 'Bool expected for require mention.' assert isinstance(value, bool), 'Bool expected for require mention.'
69 70 self.requireMention = value self.requireMention = value
70 71
71 def is_triggered(self, botly, **eventInfo):
72 def is_triggered(self, bot, **eventInfo):
72 73 """This should only be called from Bot class. """This should only be called from Bot class.
73 74
74 75 Checks whether or not the trigger object activates based on the Checks whether or not the trigger object activates based on the
 
... ... class Trigger:
81 82
82 83 # Checks if bot is mentioned if it is required: # Checks if bot is mentioned if it is required:
83 84 if self.requireMention and 'message' in self.eventName: if self.requireMention and 'message' in self.eventName:
84 if not botly.me.mentioned_in(eventInfo['message']):
85 if not bot.me.mentioned_in(eventInfo['message']):
85 86 return False return False
86 87
87 88 # Check for conditions: # Check for conditions:
 
... ... class Trigger:
102 103 return randrange(1, 101) < self.triggerChance return randrange(1, 101) < self.triggerChance
103 104
104 105 def _is_condition_true(self, condition, **eventInfo): def _is_condition_true(self, condition, **eventInfo):
105 v = condition[0]
106 p = condition[1]
106 variable = condition[0]
107 pattern = condition[1]
107 108
108 if v == 'author':
109 if variable == 'author':
109 110 if 'message' in self.eventName: if 'message' in self.eventName:
110 if re.match(p, eventInfo['message'].author.id):
111 if re.match(pattern, eventInfo['message'].author.id):
111 112 return True return True
112 113 if 'on_typing' == self.eventName: if 'on_typing' == self.eventName:
113 if re.match(p, eventInfo['user'].id):
114 if re.match(pattern, eventInfo['user'].id):
114 115 return True return True
115 elif v == 'message':
116 elif variable == 'message':
116 117 if 'message' in self.eventName: if 'message' in self.eventName:
117 if re.match(p, eventInfo['message'].content):
118 if re.match(pattern, eventInfo['message'].content):
118 119 return True return True
119 120
120 121 def _is_pattern_valid(self, pattern): def _is_pattern_valid(self, pattern):
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