Queer European MD passionate about IT
Browse Source

Add user table if missing

Davte 5 years ago
parent
commit
1511b4742f
1 changed files with 13 additions and 0 deletions
  1. 13 0
      davtelepot/bot.py

+ 13 - 0
davtelepot/bot.py

@@ -2464,6 +2464,19 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
 
     def setup(self):
         """Make bot ask for updates and handle responses."""
+        with self.db as db:
+            if 'users' not in db:
+                db['users'].insert(
+                    dict(
+                        telegram_id=9999999999,
+                        privileges=100,
+                        username="username",
+                        first_name="First",
+                        last_name="Last",
+                        language_code="en",
+                        selected_language_code="en"
+                    )
+                )
         if not self.webhook_url:
             asyncio.ensure_future(self.get_updates())
         else: