Code Monkey home page Code Monkey logo

client's People

Contributors

aymenjd avatar github-actions[bot] avatar killometrs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

client's Issues

how to use socks5 in pytdbot?

I'm using pytdbot with this config:

client = Client(
    api_id=VALUES['API_ID'],
    api_hash=VALUES['API_HASH'],
    database_encryption_key="1234echobot$",
    token=VALUES['BOT_TOKEN'],  # Your bot token or phone number if you want to login as user
    files_directory="BotDB",  # Path where to store TDLib files
    lib_path="/usr/local/lib/libtdjson.so.1.8.29", # Path to TDjson shared library
    td_log=LogStreamFile("tdlib.log"),  # Set TDLib log file path
    td_verbosity=3,  # TDLib verbosity level
)
@client.on_updateNewMessage()
async def print_message(c: Client, message: Update):
    print(message)
client.run()

When I send a message in my bot (created by botfather), I get this log messages in tdlib.log file:

[ 3][t 4][1716030841.368099212][ConnectionCreator.cpp:1027][#1][!ConnectionCreator][&connections] [hash:0xe8d0ca4a] wakeup
[ 3][t 4][1716030841.368463993][ConnectionCreator.cpp:820][#1][!ConnectionCreator][&connections] In client_loop: [client:0xe8d0ca4a]
[ 3][t 4][1716030841.368767023][ConnectionCreator.cpp:711][#1][!ConnectionCreator][&connections] Create: [[2001:b28:f23d:f001::a]:80] to DcId{1}
[ 2][t 4][1716030841.369091272][ConnectionCreator.cpp:888][#1][!ConnectionCreator] [[2001:b28:f23d:f001::a]:80] to DcId{1}: [PosixError : Network is unreachable : 101 : Failed to connect to [[2001:b28:f23d:f001::a]:80]]
[ 3][t 4][1716030841.369387149][ConnectionCreator.cpp:996][#1][!ConnectionCreator][&connections] [client:0xe8d0ca4a] set timeout in 0.099997
[ 3][t 4][1716030841.469857215][ConnectionCreator.cpp:1027][#1][!ConnectionCreator][&connections] [hash:0xe8d0ca4a] wakeup
[ 3][t 4][1716030841.470253229][ConnectionCreator.cpp:820][#1][!ConnectionCreator][&connections] In client_loop: [client:0xe8d0ca4a]
[ 3][t 4][1716030841.470546007][ConnectionCreator.cpp:996][#1][!ConnectionCreator][&connections] [client:0xe8d0ca4a] set timeout in 15.891231
[ 3][t 0][1716030841.877526044][Client.cpp:293][&td_requests] End to wait for updates, returning object 0 (nil)
[ 3][t 0][1716030841.878475189][Client.cpp:280][&td_requests] Begin to wait for updates with timeout 1.000000

I think it's because of internet filtering in my country! So, is there any way to use socks5 in pytdbot?

device model

when use parameter device_model in client
auto detect CPython3.x

client = Client(
    api_id=6,
    api_hash="eb06d4abfb49dc3eeb1aeb98ae0f581e",
    database_encryption_key="1234echobot$",
    files_directory="BotDB",  # Path where to store TDLib files
    device_model='PC x64',
    lib_path="./libtdjson.so.1.8.21",  # Path to TDjson shared library
    td_verbosity=1,  # TDLib verbosity level,
    options={
        "ignore_background_updates": True,
    }
)

Why can't I copy the example code after installation? thank you for your reply

E:\pythonProject\tg-td\venv\Scripts\python.exe E:\pythonProject\tg-td\main.py
[INFO][p 432 MainThread][1679412951.684244][tdjson.py:39][init] Initializing TDjson client with library: C:\Windows\system32\tdjson.dll
[INFO][p 432 MainThread][1679412951.699214][tdjson.py:80][_build_client] Using TDLib 1.8.12 (70bee089d)
Traceback (most recent call last):
File "E:\pythonProject\tg-td\main.py", line 69, in
client.run()
File "E:\pythonProject\tg-td\venv\lib\site-packages\pytdbot\client.py", line 433, in run
self._register_signal_handlers()
File "E:\pythonProject\tg-td\venv\lib\site-packages\pytdbot\client.py", line 1106, in _register_signal_handlers
self.loop.add_signal_handler(sig, _handle_signal)
File "D:\software\Microsoft Visual Studio\Shared\Python39_64\lib\asyncio\events.py", line 539, in add_signal_handler
raise NotImplementedError
NotImplementedError

进程已结束,退出代码1
This is an echo robot example, the code is copied as it is, only the ID is changed
My technique is not good enough. If possible, please answer.
thanks

error reply message

this is my code:

@app.on_updateNewMessage()
async def reply_message(c: Client, message: Update):
    print(await message.reply_text('test', quote=True, parse_mode='html'))

get this error

{
    "@type": "error",
    "code": 400,
    "message": "Failed to parse JSON object as TDLib request: Unknown class \"messageReplyToMessage\""
}

version 0.8.6

Problem with sending message Album

I can't send messageAlbum

There is code

@client.on_updateNewMessage()
async def start(c: Client, message: Update):
user_id = message['message']['sender_id']['user_id']
if await redis.exists(f'{str(user_id)}_data') == 0:
if message.text == '/start':
# await c.sendPhoto(chat_id=user_id, photo=InputFileId(file3))
await c.sendMessageAlbum(chat_id=user_id, message_thread_id=0,
input_message_contents=[InputFileRemote(file1), InputFileRemote(file2)])

Error:

File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\json\encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type InputFileRemote is not JSON serializable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.