-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed another failing test caused by absolute imports
- Loading branch information
Showing
2 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |