1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Forward message method done.

This commit is contained in:
eternnoir 2015-06-26 22:35:52 +08:00
parent e99815adcf
commit 67aaed4f20
3 changed files with 19 additions and 8 deletions

View File

@ -48,7 +48,7 @@ while True:
- [x] getMe
- [x] sendMessage
- [ ] forwardMessage
- [x] forwardMessage
- [ ] sendPhoto
- [ ] sendAudio
- [ ] sendDocument

View File

@ -111,4 +111,11 @@ class TeleBot:
reply_markup)
def forward_message(self, chat_id, from_chat_id, message_id):
"""
:param chat_id: which chat to forward
:param from_chat_id: which chat message from
:param message_id: message id
:return:
"""
return apihelper.forward_message(self.token, chat_id, from_chat_id, message_id)

View File

@ -3,13 +3,15 @@
import telebot
import requests
def get_me(token):
api_url=telebot.API_URL
api_url = telebot.API_URL
method_url = r'getMe'
request_url = api_url+'bot'+token+'/'+method_url
request_url = api_url + 'bot' + token + '/' + method_url
req = requests.get(request_url)
return req.json()
def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None):
"""
Use this method to send text messages. On success, the sent Message is returned.
@ -34,17 +36,19 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m
req = requests.get(request_url, params=payload)
return req.json()
def get_updates(token):
api_url = telebot.API_URL
method_url = r'getUpdates'
request_url = api_url+'bot'+token+'/'+method_url
request_url = api_url + 'bot' + token + '/' + method_url
req = requests.get(request_url)
return req.json()
def forward_message(token,chat_id,from_chat_id,message_id):
def forward_message(token, chat_id, from_chat_id, message_id):
api_url = telebot.API_URL
method_url = r'forwardMessage'
request_url = api_url+'bot'+token+'/'+method_url
payload = {'chat_id':chat_id,'from_chat_id':from_chat_id,'message_id':message_id}
req = requests.get(request_url,params=payload)
request_url = api_url + 'bot' + token + '/' + method_url
payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id}
req = requests.get(request_url, params=payload)
return req.json()