OSDN Git Service
(root)
/
simple-tornado-bot
/
simple-tornado-bot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
643e15e
)
update
author
yamat0jp
<yamat0jp@yahoo.co.jp>
Tue, 11 Sep 2018 11:30:50 +0000
(20:30 +0900)
committer
yamat0jp
<yamat0jp@yahoo.co.jp>
Tue, 11 Sep 2018 11:30:50 +0000
(20:30 +0900)
bot.py
patch
|
blob
|
history
diff --git
a/bot.py
b/bot.py
index
a6da696
..
15704c1
100644
(file)
--- a/
bot.py
+++ b/
bot.py
@@
-62,7
+62,9
@@
class WebHookHandler(tornado.web.RequestHandler):
if dbname in client.collection_names(include_system_collections=False):
db = client['users']
item = db.find_one({'name':self.uid})
- if item['dbname'] == dbname:
+ if not item:
+ db.insert({'user':self.id, 'dbname':dbname})
+ elif item['dbname'] == dbname:
return False
else:
db.update({'user':self.uid, 'dbname':dbname})