Coder Social home page Coder Social logo

Comments (3)

socketpair avatar socketpair commented on June 19, 2024 1

I tried. It does not work:

app.send_message('t.me/joinchat/AAAAAEF9C4.....', message.text)
Pyrogram v0.15.1, Copyright (C) 2017-2019 Dan <https://github.com/delivrance>
Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

[400 USERNAME_INVALID]: The username is invalid (caused by "contacts.ResolveUsername")
Traceback (most recent call last):
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/client.py", line 1258, in resolve_peer
    return self.storage.get_peer_by_id(peer_id)
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/storage/memory_storage.py", line 142, in get_peer_by_id
    raise KeyError("ID not found: {}".format(peer_id))
KeyError: 'ID not found: t.me/joinchat/AAAAAEF9C4...'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/client.py", line 1267, in resolve_peer
    int(peer_id)
ValueError: invalid literal for int() with base 10: 't.me/joinchat/aaaaaef9c4...'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/client.py", line 1270, in resolve_peer
    return self.storage.get_peer_by_username(peer_id)
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/storage/memory_storage.py", line 153, in get_peer_by_username
    raise KeyError("Username not found: {}".format(username))
KeyError: 'Username not found: t.me/joinchat/aaaaaef9c4...'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/ext/dispatcher.py", line 180, in update_worker
    handler.callback(self.client, *args)
  File "./main.py", line 11, in hello
    app.send_message('t.me/joinchat/AAAAAEF9C4...', message.text)
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/methods/messages/send_message.py", line 84, in send_message
    peer=self.resolve_peer(chat_id),
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/client.py", line 1274, in resolve_peer
    username=peer_id
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/client/client.py", line 984, in send
    r = self.session.send(data, retries, timeout)
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/session/session.py", line 437, in send
    return self._send(data, timeout=timeout)
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/session/session.py", line 424, in _send
    RPCError.raise_it(result, type(data))
  File "/home/mmarkk/.local/lib/python3.7/site-packages/pyrogram/errors/rpc_error.py", line 83, in raise_it
    is_unknown=False)
pyrogram.errors.exceptions.bad_request_400.UsernameInvalid: [400 USERNAME_INVALID]: The username is invalid (caused by "contacts.ResolveUsername")

from pyrogram.

delivrance avatar delivrance commented on June 19, 2024

https://docs.pyrogram.ml/pyrogram/Client#pyrogram.Client.send_message

chat_id (int | str) - Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str). For a private channel/supergroup you can use its t.me/joinchat/ link.

from pyrogram.

socketpair avatar socketpair commented on June 19, 2024

And If I use join_chat() with the same URL, it says that I'm already joined. Sending to myself or to other groups work. Also, this channel is missing in my_account.session. I created this channel recently, but after first experiments with the library. I guess some caches are not filled.

from pyrogram.

Related Issues (20)

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.