def run(self, msg, matches): print(matches.group(1)) if matches.group(1).endswith("gifv"): return filename = self.bot.download_to_file(matches.group(1), matches.group(2)) if filename: peer = self.bot.get_peer_to_send(msg) tgl.send_document(peer, filename)
def run(self, msg, matches): print(matches.group(1)) if matches.group(1).endswith("gifv"): return filename = self.bot.download_to_file(matches.group(1), matches.group(2)) if filename: peer = self.bot.get_peer_to_send(msg) tgl.send_document(peer, filename)
def send_pic(self, msg, pic_url): def cleanup_cb(success, msg): if success: os.remove(filename) else: peer.send_msg("Fap: something went wrong") extension = pic_url.split(".")[-1] filename = self.bot.download_to_file(pic_url, extension) peer = self.bot.get_peer_to_send(msg) if extension.lower() == "gif": tgl.send_document(peer, filename, cleanup_cb) else: tgl.send_photo(peer, filename, cleanup_cb)