⚡ CentOS7 환경




pip install python-telegram-botpython-telegram-bot 을 pip install 해줍니다.https:*//api.telegram.org/bot+(발급받은 토큰 키)/getUpdates*
import asyncio
import sys
import telegram
TOKEN = "51############################################DFs"
CHAT_ID = "50######84"
async def send_alert(message):
bot = telegram.Bot(token=TOKEN)
await bot.sendMessage(chat_id=CHAT_ID, text=message)
def main():
message = " ".join(sys.argv[1:]) or 'Bot에서 보낸 메세지입니다.'
asyncio.run(send_alert(message))
if __name__ == '__main__':
main()
