bafser tg api
Project description
bafser tgapi
usage
init project: bafser init_project
set webhook: bafser configure_webhook set
delete webhook: bafser configure_webhook delete
main.py
import sys
import bafser_tgapi as tgapi
from bafser import AppConfig, create_app
from bot.bot import Bot
from scripts.init_db import init_db
app, run = create_app(__name__, AppConfig(DEV_MODE="dev" in sys.argv))
tgapi.setup(botCls=Bot, app=app)
DEVSERVER = "devServer" in sys.argv
if DEVSERVER:
tgapi.set_webhook()
run(DEVSERVER, init_db)
if not DEVSERVER:
if __name__ == "__main__":
tgapi.run_long_polling()
else:
tgapi.set_webhook()
init_db.py
from bafser import AppConfig
from sqlalchemy.orm import Session
from data.user import Roles, User
def init_db(db_sess: Session, config: AppConfig):
u = User.new(db_sess, 12345, False, "Admin", "", "username", "en")
u.add_role(u, Roles.admin)
db_sess.commit()
data.user.py
from bafser_tgapi import TgUserBase
from data import Roles
class User(TgUserBase):
_default_role = Roles.user
data.msg.py
from bafser_tgapi import MsgBase
from data import Tables
class Msg(MsgBase):
__tablename__ = Tables.Msg
bot.py
import bafser_tgapi as tgapi
from data.user import User
class Bot(tgapi.BotWithDB[User]):
_userCls = User
call other method
import json
import bafser_tgapi as tgapi
ok, r = tgapi.call("getStickerSet", {
"name": "AnimatedEmojies",
})
with open("r.json", "w") as f:
json.dump(r, f)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bafser_tgapi-1.4.0.tar.gz.
File metadata
- Download URL: bafser_tgapi-1.4.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0e34e8ff6e0711345df5b9c519c9360865665de2e40875462cb38ad96ffa989
|
|
| MD5 |
d5c7712e405c6ee7aed2311419ffe7d1
|
|
| BLAKE2b-256 |
42aa4d70261b5ae726477f0e90ba20b022aa9d16018353b6a7e893301661217a
|
Provenance
The following attestation bundles were made for bafser_tgapi-1.4.0.tar.gz:
Publisher:
main.yml on MixelTe/bafser_tgapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bafser_tgapi-1.4.0.tar.gz -
Subject digest:
a0e34e8ff6e0711345df5b9c519c9360865665de2e40875462cb38ad96ffa989 - Sigstore transparency entry: 581256492
- Sigstore integration time:
-
Permalink:
MixelTe/bafser_tgapi@53e380680f0916cebf4623dc3d7e685999f81e6e -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/MixelTe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@53e380680f0916cebf4623dc3d7e685999f81e6e -
Trigger Event:
push
-
Statement type:
File details
Details for the file bafser_tgapi-1.4.0-py3-none-any.whl.
File metadata
- Download URL: bafser_tgapi-1.4.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64e6f8a5aa85669d4d089ad223430ec4b2563935343fd74ae5381bdb64dd08d8
|
|
| MD5 |
2caeb6bb63f30207948408e7f8a8543e
|
|
| BLAKE2b-256 |
2f053a58c3bb3cbad2108f7b4b2a06acc634f87ab1ebc990d9310451dd6ec4b9
|
Provenance
The following attestation bundles were made for bafser_tgapi-1.4.0-py3-none-any.whl:
Publisher:
main.yml on MixelTe/bafser_tgapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bafser_tgapi-1.4.0-py3-none-any.whl -
Subject digest:
64e6f8a5aa85669d4d089ad223430ec4b2563935343fd74ae5381bdb64dd08d8 - Sigstore transparency entry: 581256495
- Sigstore integration time:
-
Permalink:
MixelTe/bafser_tgapi@53e380680f0916cebf4623dc3d7e685999f81e6e -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/MixelTe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@53e380680f0916cebf4623dc3d7e685999f81e6e -
Trigger Event:
push
-
Statement type: