bafser tgapi
usage
- init project:
bafser init_project - set webhook:
bafser configure_webhook set - delete webhook:
bafser configure_webhook delete - get sticker file_id:
bafser stickers
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)
Metadata
Release files for bafser-tgapi 1.11.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bafser_tgapi-1.11.1.tar.gz | 19.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bafser_tgapi-1.11.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.1 kB
Release files / bafser_tgapi-1.11.1.tar.gz
| Download URL | bafser_tgapi-1.11.1.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4486ccb17cf09270a4adf5bcc1e1df1681c514e8242be4b0a36a700d65e48d46
|
|
BLAKE2b-256 checksum How to use checksums |
d81677065840d0eab50ee1bfffc9f4b8b08644d85a5cc98de1b60066e729908a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / bafser_tgapi-1.11.1-py3-none-any.whl
| Download URL | bafser_tgapi-1.11.1-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae4577e83a90faa6ee058754b039544e70763e5af99468b8098b83e0098dfe86
|
|
BLAKE2b-256 checksum How to use checksums |
23cd13835177c88c67cc40e9a85c955bb982a9926f928485721c15134cac3b70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency log