반응형
Notice
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 보안
- 사이버보안
- 소프트웨어공학
- 빅데이터
- Yes
- 파이썬
- 자료구조
- 컴퓨터과학
- 프로그래밍언어
- 인공지능
- 버전관리
- 디자인패턴
- 소프트웨어
- 자바스크립트
- springboot
- 데이터분석
- 컴퓨터공학
- 머신러닝
- I'm Sorry
- 데이터과학
- 데이터베이스
- 프로그래밍
- 딥러닝
- 웹개발
- 알고리즘
- 네트워크
- 클라우드컴퓨팅
- 데이터구조
- 컴퓨터비전
- 네트워크보안
Archives
- Today
- Total
스택큐힙리스트
어떻게 내 텔레그램 봇을 사용하여 상대방의 사용자 이름으로 메시지를 전송할 수 있을까요? 본문
반응형
저는 telepot 파이썬 라이브러리를 사용하고 있습니다. 누군가의 사용자 ID(숫자로 이루어진 것)를 가지고 있으면 메시지를 보낼 수 있다는 것을 알고 있습니다.
하지만 사용자의 사용자 이름만 가지고 있고 사용자 ID가 없을 때 메시지를 보낼 수 있는 방법이 있는지 알고 싶습니다('@'로 시작하는 사용자 이름). 또한 사용자 이름을 사용자 ID로 변환하는 방법이 있는지 알고 싶습니다.
답변 1
- 사용자로부터 봇으로 메시지 하나를 전송합니다.
https://api.telegram.org/bot<봇_토큰>/getUpdates
페이지를 엽니다.- 이 메시지를 찾고 result->message->chat->id 키로 이동합니다.
- 이 ID를 [chat_id] 매개변수로 사용하여 사용자에게 개인 메시지를 전송합니다.
답변 2
[Korean Essay]텔레그램 봇을 사용하여 상대방에게 메시지를 보내려면 어떻게 해야 할까?
텔레그램은 신속하고 효율적인 메시징 서비스로서 전 세계적으로 많은 사람들이 사용하고 있다. 텔레그램을 사용하여 메시지를 전달하는 것은 매우 간단하며, 텔레그램 봇을 통해 다른 사용자에게 메시지를 보내는 것도 마찬가지이다. 이를 통해 사용자는 편리하게 상대방과 소통할 수 있다.
텔레그램 봇을 이용하여 사용자에게 메시지를 보내기 위해서는 먼저 해당 사용자의 유저네임이 필요하다. 유저네임은 다른 사용자들이 상대방을 식별할 수 있는 고유한 식별자이다. 만일 상대방의 유저네임을 알고 있다면, 다음과 같은 절차를 통해 메시지를 보낼 수 있다.
첫째, 텔레그램 봇에게 상대방의 유저네임을 알려준다. 이때 유저네임은 봇에게 메시지를 보낼 대상을 지정하는 역할을 한다. 예를 들어, /message @사용자이름과 같이 입력하면 해당 유저에게 메시지를 보낼 수 있다.
둘째, 텔레그램 봇의 채팅창에 메시지를 작성한다. 메시지는 간단한 텍스트 메시지일 수도 있고, 사진, 동영상, 파일 등의 멀티미디어 형식일 수도 있다. 원하는 내용을 작성한 후 엔터를 눌러 메시지를 전송한다.
이와 같은 방법을 사용하여, 텔레그램 봇을 통해 다른 사용자에게 메시지를 보낼 수 있다. 텔레그램은 사용자들이 서로간에 쉽게 커뮤니케이션을 할 수 있는 환경을 제공하고 있으며, 봇을 활용하면 더욱 편리하게 메시지를 전송하고 받을 수 있게 된다.
[English Translation]
How can I send a message to someone with my Telegram bot using their username?
Telegram is a fast and efficient messaging service used by many people worldwide. Sending messages through Telegram is straightforward, and sending messages to other users through a Telegram bot is equally simple. This allows users to conveniently communicate with others.
To send a message to a user using a Telegram bot, you first need to know their username. Usernames are unique identifiers that allow other users to identify someone. If you know the username of the person you want to message, you can follow these steps:
First, inform the Telegram bot about the user's username. The username plays a role in specifying the recipient of the message for the bot. For example, by typing /message @username, you can send a message to that user.
Second, compose the message in the Telegram bot's chat window. The message can be a simple text message or multimedia formats such as pictures, videos, or files. After writing the desired content, press enter to send the message.
By using this method, you can send messages to other users through a Telegram bot. Telegram provides an environment where users can easily communicate with each other, and through the use of bots, sending and receiving messages becomes even more convenient.
반응형
Comments