File size: 1,172 Bytes
9f99fe2
 
 
 
 
 
 
 
 
 
 
0c384f5
9f99fe2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c384f5
9f99fe2
db167ca
9f99fe2
 
0c384f5
9f99fe2
 
 
 
 
 
 
0c384f5
ac8786f
9f99fe2
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import logging
import os
import sys
import threading

sys.path.insert(0, "src")
os.environ['TRANSFORMERS_CACHE'] = '/tmp'

from telegram.ext import (
    Application,
)
from api import BuddyPanda
from functools import partial  
from typing import List
from telegram import Update
from termcolor import colored

SELECT_COMMAND, GET_TEXT = range(2)

# Enable logging
logging.basicConfig(
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
)
logger = logging.getLogger(__name__)


class LoggingDisabled:
    """Context manager that turns off logging within context."""

    def __enter__(self):
        logging.disable(logging.CRITICAL)

    def __exit__(self, exit_type, exit_value, exit_traceback):
        logging.disable(logging.NOTSET)


def main() -> None:
    app = Application.builder().token(
        '5998527257:AAFolKz-AIXDzaSj3UOmxaLZSyDVp_3LoYw',).build()

    run_agent(
        agent=BuddyPanda(
            token="hello",
            application=app
        )
    )
    print(f"Starting Agent...")


def run_agent(agent: BuddyPanda, as_api: bool = False) -> None:
    agent.handlers()


if __name__ == "__main__":
    main()