-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsender.py
More file actions
38 lines (28 loc) · 1.04 KB
/
Copy pathsender.py
File metadata and controls
38 lines (28 loc) · 1.04 KB
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
from telegram.ext import Updater, CommandHandler
from telegram.ext import MessageHandler, Filters
import telegram
import logging as log
import c
log.basicConfig(level=log.INFO, format= c.LOG_FORMAT,handlers=[ log.StreamHandler(), log.FileHandler(c.LOG_PATH+'/'+c.LOG_FILE+'.log')])
#log.info('Logging Started')
class Sender:
def __init__(self, chatid, bot, update):
self.chatid= chatid
self.bot= bot
self.update= update
def sendText(self, msg):
log.info("Sending text: "+msg)
self.bot.send_message(chat_id= self.chatid,text= msg)
def sendTextM(self, msg):
log.info("Sending text: "+msg)
self.bot.send_message(chat_id= self.chatid,text= msg, parse_mode=telegram.ParseMode.MARKDOWN)
def sendImg(self, url):
pass
def sendAudio(self, url):
log.info("Sending Audio: "+url)
self.bot.send_audio(chat_id=self.chatid, audio=open(url, 'rb'), timeout=1000)
def sendVideo(self, url):
pass
def sendDoc(self, url):
log.info('Sending Doc: '+url)
self.bot.send_document(chat_id=self.chatid, document=open(url, 'rb'), timeout= 1000)