Advertisement
ghost_net

Untitled

Oct 1st, 2019
3,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PyCon 1.66 KB | None | 0 0
  1. from gino import Gino
  2.  
  3. db_pg = Gino()
  4.  
  5.  
  6. class User(db_pg.Model):
  7.     __tablename__ = 'users_bot'
  8.  
  9.     id = db_pg.Column(db_pg.Integer(), primary_key=True)
  10.     nickname = db_pg.Column(db_pg.Unicode(), default='noname')
  11.     email = db_pg.Column(db_pg.Unicode())
  12.     _meta = db_pg.Column(db_pg.Unicode(), default="none")
  13.  
  14.  
  15. class UserLang(db_pg.Model):
  16.     __tablename__ = 'users_lang'
  17.  
  18.     id = db_pg.Column(db_pg.Integer(), primary_key=True)
  19.     lang = db_pg.Column(db_pg.Unicode())
  20.  
  21.  
  22. class AccessToken(db_pg.Model):
  23.     __tablename__ = 'access_token_auth'
  24.  
  25.     chat_id = db_pg.Column(db_pg.Integer())
  26.     token_github = db_pg.Column(db_pg.Unicode(), default='0')
  27.     token_google = db_pg.Column(db_pg.Unicode(), default='0')
  28.  
  29.  
  30. class PastebinTable(db_pg.Model):
  31.     __tablename__ = 'PastebinTable'
  32.  
  33.     chat_id = db_pg.Column(db_pg.Integer())
  34.     paste = db_pg.Column(db_pg.Unicode())
  35.  
  36.  
  37. async def task():
  38.     await db_pg.set_bind(help.POSTGRES)
  39.     await db_pg.gino.create_all()
  40.     u1 = await pastebin_table.create(chat_id=21, paste="ahjsdg")
  41.     print(u1)
  42.     """
  43.  
  44.     """
  45.  
  46.  
  47. @dp.message_handler(commands=["make_paste"])
  48. async def make_paste(message: types.Message) -> Button.buttons:
  49.     #   try:
  50.     s = await PastebinTable.create(paste=message.reply_to_message.text, chat_id=message.chat.id)
  51.     print(s)
  52.     return await message.answer(text=lazy_get_text("какой формат?"),
  53.                                 reply_markup=Button.buttons(text=["pastebin", "jsonbox"],
  54.                                                             call_back=["pastebin",
  55.                                                                        "jsonbox"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement