Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nawab: Fix the keyboard Interrupt #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions nawab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pandas as pd
import pwd
import os
import sys
import threading
import argparse
import logging
Expand Down Expand Up @@ -45,11 +46,17 @@ def tg_bot_run(self, auto_retweet=None):
dp.add_error_handler(bot.error)

# Start the Bot
updater.start_polling()

# Run the bot until the user presses Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT
updater.idle()
try:
updater.start_polling()
except KeyboardInterrupt:
try:
sys.exit(1)
except SystemExit:
os._exit(1)



def wrapper(func, args, res):
Expand Down Expand Up @@ -119,5 +126,11 @@ def main():
nawab.tg_bot_run()


if __name__ == "__main__":
main()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
try:
sys.exit(1)
except SystemExit:
os._exit(1)