Skip to content

Commit

Permalink
Fixed another failing test caused by absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
OrBin committed Mar 17, 2019
1 parent e71cb60 commit d325c34
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
32 changes: 0 additions & 32 deletions gramhopper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
import logging
from telegram.ext import Updater
from gramhopper.configuration import token_file_path, rules_file_path
from gramhopper.handlers.combined_handlers import CombinedConversationHandler
from gramhopper.handlers.default_error_handler import handle_error
from gramhopper.configuration.rules_parser import RulesParser


def main():
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)

with open(token_file_path(), 'r') as token_file:
bot_token = token_file.read().strip()

rule_parser = RulesParser()
rule_handlers = rule_parser.parse_file(rules_file_path())
conversation_handler = CombinedConversationHandler(rule_handlers)

updater = Updater(bot_token)
updater.dispatcher.add_handler(conversation_handler)
updater.dispatcher.add_error_handler(handle_error)
updater.start_polling()

# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()


if __name__ == '__main__':
main()
32 changes: 32 additions & 0 deletions gramhopper/bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import logging
from telegram.ext import Updater
from gramhopper.configuration import token_file_path, rules_file_path
from gramhopper.handlers.combined_handlers import CombinedConversationHandler
from gramhopper.handlers.default_error_handler import handle_error
from gramhopper.configuration.rules_parser import RulesParser


def main():
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)

with open(token_file_path(), 'r') as token_file:
bot_token = token_file.read().strip()

rule_parser = RulesParser()
rule_handlers = rule_parser.parse_file(rules_file_path())
conversation_handler = CombinedConversationHandler(rule_handlers)

updater = Updater(bot_token)
updater.dispatcher.add_handler(conversation_handler)
updater.dispatcher.add_error_handler(handle_error)
updater.start_polling()

# Run the bot until you press Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()


if __name__ == '__main__':
main()

0 comments on commit d325c34

Please sign in to comment.