bobby-b-bot / reddit

Reddit client for Bobby B Bot
MIT License
69 stars 11 forks source link

Nothing shows up in command prompt after I run reddit_bot.py #5

Open andrewcreed opened 5 years ago

andrewcreed commented 5 years ago

As mentioned in my previous issue, after using the fix suggested, the errors no longer show up (which is good!"), however, nothing else shows up either after running reddit_boy.py. Is it meant to? Furthermore, none of my trigger words seem to interest my bot, who would rather remain silent than do as I command.

fzanettini commented 5 years ago

This might sound silly, but is the process really being executed, i.e. hanging? Or does the script finish executing quickly without any outputs?

Also, how is your logs configuration file?

andrewcreed commented 5 years ago

If I run the script, it just shows the command of executing it, but not much else, but the command prompt remains open.

My logging-config file contains the following:

[loggers]
keys=root,sLogger

[handlers]
keys=consoleHandler,fileHandler

[formatters]
keys=fileFormatter,consoleFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[logger_sLogger]
level=DEBUG
handlers=consoleHandler,fileHandler
qualname=sLogger
propagate=0

[handler_consoleHandler]
class=StreamHandler
level=WARNING
formatter=consoleFormatter
args=(sys.stdout,)

[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=fileFormatter
args=('logfile.log',)

[formatter_fileFormatter]
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
datefmt=

[formatter_consoleFormatter]
format=%(levelname)s - %(message)s
datefmt=

I have a feeling this may be the problem.

fzanettini commented 5 years ago

The consoleHandler, which is a StreamHandler to stdout, has log level as WARNING and most logs in the bot are on level INFO, which would not appear on a WARNING level log.

Can you try to change that and see if the logs give us any hints?

andrewcreed commented 5 years ago

Changing it to DEBUG yielded the following results.

INFO - Started Reddit bot INFO - Running on environment: TEST INFO - Got subreddit names: bot running on 2 subreddits INFO - Loaded blocked users list: 2 users INFO - Instantiated Reddit client INFO - Got posts that were already replied

However, the bot is still not replying to anyone. He's being very anti-social for a bot.

fzanettini commented 5 years ago

It's great the logs are now being prompted in std_out!

From the log messages, it seems the Reddit API client is being instantiated correctly and the bot remains in the "listening" state until it fetches a trigger word. I assume there is an issue with the trigger words, can you share your trigger words file and one example when you try to call the bot?

andrewcreed commented 5 years ago

I can give you around eighteen examples of me attempting to summon this dishonorable bot.

This is the triggers file.

[[  
    "leto",
    "jared leto",
    "leto joker"
 ]]
fzanettini commented 5 years ago

I think the issue is that your triggers file is using a nested list, and thus the check is run on the first list, which only contains the actual list with the keywords, and so it is checking against an "empty" list of triggers.

Can you try and remove one pair of the [ and ] characters in your triggers file as in the example?

andrewcreed commented 5 years ago

I have removed one of the pairs, and it still is not responding. I'm not sure why there was two pairs in the first place.

fzanettini commented 5 years ago

It seems the bot remains listening for the trigger words. Is there anything in the blocked_users list?

andrewcreed commented 5 years ago

Sorry about the delay in responding.

The blocked_users list is the same as the one provided by you.

fzanettini commented 5 years ago

Sorry about the delay as well. It seems this was indeed a bug and now it is solved in the following pull request:

https://github.com/bobby-b-bot/utils/pull/4

Can you update and retry?

andrewcreed commented 5 years ago

Still isn't working, despite the fix. Maybe it isn't meant to be.

On Sat, 24 Aug 2019 at 03:22, Felipe Zanettini notifications@github.com wrote:

Sorry about the delay as well. It seems this was indeed a bug and now it is solved in the following pull request:

bobby-b-bot/utils#4 https://github.com/bobby-b-bot/utils/pull/4

Can you update and retry?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bobby-b-bot/reddit/issues/5?email_source=notifications&email_token=ACMMJH54O24DODJE7M65GFLQGCLNXA5CNFSM4IE7JI22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5BV4VQ#issuecomment-524508758, or mute the thread https://github.com/notifications/unsubscribe-auth/ACMMJH5P5AUPW7GCNJIHXQLQGCLNXANCNFSM4IE7JI2Q .