mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-16 22:06:17 +00:00
add server
This commit is contained in:
5
olgram/migrations/models/1_20210909220512_update.sql
Normal file
5
olgram/migrations/models/1_20210909220512_update.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- upgrade --
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
ALTER TABLE "bot" ADD "code" UUID NOT NULL DEFAULT uuid_generate_v4();
|
||||
-- downgrade --
|
||||
ALTER TABLE "bot" DROP COLUMN "code";
|
||||
@@ -1,6 +1,6 @@
|
||||
from tortoise.models import Model
|
||||
from tortoise import fields
|
||||
|
||||
from uuid import uuid4
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class Bot(Model):
|
||||
token = fields.CharField(max_length=50, unique=True)
|
||||
owner = fields.ForeignKeyField("models.User", related_name="bots")
|
||||
name = fields.CharField(max_length=33)
|
||||
code = fields.UUIDField(default=uuid4, index=True)
|
||||
start_text = fields.TextField(default=dedent("""
|
||||
Здравствуйте!
|
||||
Напишите ваш вопрос и мы ответим вам в ближайшее время.
|
||||
|
||||
@@ -38,6 +38,14 @@ class ServerSettings(AbstractSettings):
|
||||
def hook_port(cls) -> int:
|
||||
return int(cls._get_env("WEBHOOK_PORT"))
|
||||
|
||||
@classmethod
|
||||
def app_host(cls) -> str:
|
||||
return "olgram"
|
||||
|
||||
@classmethod
|
||||
def app_port(cls) -> int:
|
||||
return 80
|
||||
|
||||
|
||||
class BotSettings(AbstractSettings):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user