Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Added set accessor for users. Added change_affinity() | 62ffb2301d0474abcf0afbca4b9bb4706821dd46 | Detche | 2016-12-03 11:38:00 |
Added date and time on log entries | 7ea1d025aa1ce07d42e3c9fe2065a1d1b12f0679 | Detche | 2016-12-03 11:35:29 |
Updated examples | b7dd5285bf52883a01339df401091749df97f856 | Detche | 2016-12-03 11:34:31 |
Fixed trigger change method | 69251e3588123264763e72e0d75e24f6efabac21 | Detche | 2016-12-01 15:36:51 |
Reverted to Python 3.4 asyncio syntax. | 43f7209ba91a14f6e6ac1f9727542c2184660399 | Detche | 2016-12-01 15:05:40 |
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 |
File | Lines added | Lines deleted |
---|---|---|
botly/users.py | 15 | 2 |
File botly/users.py changed (mode: 100644) (index c119446..4e4eb32) | |||
... | ... | class Users(Db): | |
11 | 11 | self.userCache = [] | self.userCache = [] |
12 | 12 | self.root = self.get_node('/BotDb/Knowledge') | self.root = self.get_node('/BotDb/Knowledge') |
13 | 13 | ||
14 | # Shortcut higher level methods: | ||
15 | |||
14 | 16 | def is_master(self, userid): | def is_master(self, userid): |
15 | 17 | """Returns whether or not this user can control the bot.""" | """Returns whether or not this user can control the bot.""" |
16 | 18 | user = self.get(userid) | user = self.get(userid) |
... | ... | class Users(Db): | |
26 | 28 | return int(user['BotAffinity']) | return int(user['BotAffinity']) |
27 | 29 | return 0 | return 0 |
28 | 30 | ||
31 | def change_affinity(self, userid, delta): | ||
32 | """Increase or decrease the affinity with the user.""" | ||
33 | curr = self.affinity(userid) | ||
34 | return self.set(userid, 'BotAffinity', str(curr + delta)) | ||
35 | |||
36 | # Low level methods: | ||
37 | |||
29 | 38 | def get(self, userid): | def get(self, userid): |
30 | 39 | """Returns the user with given ID or None if it does not exist.""" | """Returns the user with given ID or None if it does not exist.""" |
31 | 40 | user = self._get_cached_user(userid) | user = self._get_cached_user(userid) |
... | ... | class Users(Db): | |
36 | 45 | def set(self, userid, valueName, value): | def set(self, userid, valueName, value): |
37 | 46 | """Modify the user valueName with given value.""" | """Modify the user valueName with given value.""" |
38 | 47 | user = self.get(userid) | user = self.get(userid) |
39 | # TODO | ||
40 | pass | ||
48 | if user is not None: | ||
49 | user[valueName] = value | ||
50 | return self.store_object('Users', user) | ||
51 | return False | ||
41 | 52 | ||
42 | 53 | def get_all(self): | def get_all(self): |
43 | 54 | """Returns all users from the database.""" | """Returns all users from the database.""" |
... | ... | class Users(Db): | |
46 | 57 | self.userCache = users | self.userCache = users |
47 | 58 | return users | return users |
48 | 59 | ||
60 | # Internal methods | ||
61 | |||
49 | 62 | def _new_user(self, userid): | def _new_user(self, userid): |
50 | 63 | # TODO | # TODO |
51 | 64 | pass | pass |