Answer the question
In order to leave comments, you need to log in
How to use telegram bots externally?
Hello everyone, there is such a bot in telegrams @whoisdombot to check the entry of domains, please tell me if this bot can be used externally somehow? That is, through the Telegram services API, send requests to this bot and receive? Please tell me I really need to solve this problem.
Answer the question
In order to leave comments, you need to log in
Why complicate?
Here's whois with an open API.
Write a Bot, so be it written for you, you will bring prettiness.
import telebot
import requests
token_test = ""
bot = telebot.TeleBot(token_test)
api_url = 'http://ip-api.com/json/'
@bot.message_handler(commands=['start'])
def send_welcome(message):
msg = bot.reply_to(message, """\
Hello, I am WHOIS bot.
Input IP or Hostname?
""")
bot.register_next_step_handler(msg, get_info)
def get_info(message):
try:
r = requests.get(api_url + message.text)
info = r.text
except Exception as E:
print(E)
info = 'Ooops'
bot.send_message(chat_id=message.chat.id, text=info)
if __name__ == "__main__":
try:
bot.polling(none_stop=True)
except Exception as Error:
print(Error)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question