-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.rb
38 lines (31 loc) · 1.12 KB
/
index.rb
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
32
33
34
35
36
37
38
require 'telegram/bot'
require 'net/dns'
TOKEN = "205192920:AAF98akmUeJ4EnR8ALHndtf5tUl9oS7sOcs"
def get_from_address(message)
message[/([\d.]+|(?:https?:\/\/)?(?:[\w]+\.)?[\w]+\.[\w]+)/]
end
def dig(address)
digged = Resolver(address)
end
help = """
You Can Use Me By These Commands :
[+] /dig [ip] or [domain]
this is very easy ;-)
"""
puts "Bot Successfully Started ! :) "
Telegram::Bot::Client.run(TOKEN) do |bot|
bot.listen do |message|
case message.text
when '/start'
bot.api.send_message(chat_id: message.chat.id, text: "Hello #{message.from.first_name} Welcome To DigggerBot U Can Use /help for commands list")
when /\/dig [\w\W]+/
bot.api.send_message(chat_id: message.chat.id, text: dig(get_from_address(message.text)))
when '/help'
bot.api.send_message(chat_id: message.chat.id ,text: help)
when '/end'
bot.api.send_message(chat_id: message.chat.id, text: "Good Bye #{message.from.first_name} See You Later My Friend! Come back Again" );
else
bot.api.send_message(chat_id: message.chat.id, text: "I Can't Understand Your Command :| ")
end
end
end