OSDN Git Service

add ball
authoryamat0jp <yamat0jp@yahoo.co.jp>
Tue, 11 Sep 2018 10:41:11 +0000 (19:41 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Tue, 11 Sep 2018 10:41:11 +0000 (19:41 +0900)
ball.txt [new file with mode: 0644]
bot.py

diff --git a/ball.txt b/ball.txt
new file mode 100644 (file)
index 0000000..b1fe686
--- /dev/null
+++ b/ball.txt
@@ -0,0 +1 @@
+@[KIRA STAR]
\ No newline at end of file
diff --git a/bot.py b/bot.py
index 80cf8de..b8be425 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -29,8 +29,7 @@ class WebHookHandler(tornado.web.RequestHandler):
         w = now.weekday()
         if (w < 5)and(t >= 9)and(t < 16):
             return u'仕事中.'
-        #table = self.users(self.name)
-        table = pymongo.MongoClient(uri)[ac]['glove']
+        table,na = self.users(self.name)
         item = table.find({'no':re.compile(no,re.IGNORECASE)})
         if item.count() == 1:
             x = item[0]
@@ -49,7 +48,7 @@ class WebHookHandler(tornado.web.RequestHandler):
             ans = self.itr(sorted(list1, key=lambda k:k['no']))
         else:
             ans = self.itr(table.find().sort('no'))
-            ans = '-*-glove list-*-\n'+ans
+            ans = '-*-'+na+' list-*-\n'+ans
         return ans
     
     def itr(self,item):
@@ -74,10 +73,11 @@ class WebHookHandler(tornado.web.RequestHandler):
         db = client['users']
         item = db.find_one({'name':name})
         if item:
-            return client[item['dbname']]
+            x = item['dbname']
+            return client[x], x
         else:
             db.insert({'name':name,'dbname':'glove'})
-            return client['glove']
+            return client['glove'], 'glove'
                 
     def post(self):
         '''