Untitled
unknown
plain_text
2 years ago
2.0 kB
5
Indexable
from telepot.loop import MessageLoop import datetime, time, telepot from dotenv import load_dotenv prefix = '/' admin = '-' load_dotenv() TOKEN = os.getenv('TOKEN') start = ''' 🎧Benvenuto ''' help = ''' /start - avvia il bot ''' helpc = ''' none ''' def handle(msg): chat_id = msg['chat']['id'] text = msg['text'] username = "none" try: username = msg['chat']['username'] except: pass log = open("./Log/log.txt", "a") ora = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") print(f"{username} ha scritto [{text}] con questo id {chat_id}") log.write(f"{ora}: {username} ha scritto [{text}] con questo id {chat_id}\n") try: os.makedirs(f"Musica/{chat_id}") except: pass file = "" try: vip = ["123", "456"] isVip = False if str(chat_id) in vip: isVip = True s = "true" if isVip else "false" file = open(f"User\\{chat_id}.json", "w+") file.write("{\n\t\"vip\" : " + s + "\n}") file.close() except: pass if text == f'{prefix}start': bot.sendMessage(chat_id, start) elif text == f'{prefix}help': bot.sendMessage(chat_id, help) elif text == f'{prefix}helpcommand': bot.sendMessage(chat_id, helpc) elif text.startswith("https://www.youtube.com") or text.startswith("https://youtu.be") or text.startswith("www.youtube.com") or text.startswith("youtu.be"): S.Uploads() elif text == f'{prefix}canzoni': S.SendList() elif text.startswith(f'{prefix}rename '): S.Rename() elif text.startswith(f'{prefix}del '): S.Delete() else: S.Search() if __name__ == '__main__': print("Online") bot = telepot.Bot(TOKEN) MessageLoop(bot, handle).run_as_thread() while 1: time.sleep(10)
Editor is loading...