Skip to content
This repository has been archived by the owner on Oct 25, 2019. It is now read-only.

Bash module #89

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Bash module #89

wants to merge 6 commits into from

Conversation

paulwalko
Copy link
Collaborator

I'm an idiot and forgot how pull requests work so this is just a continuation of #75

This module saves 100 lines of backlog at any time, then allows people to grab quotes by doing:

<a> hello
<b> yo
<c> ayy lmao            --start quote here
<b> lol                        --end here
<a> .bash c 1 b 1

and saves each quote to a plaintext file in ~/.phenny/bash_logs

@mutantmonkey mutantmonkey self-requested a review January 9, 2019 04:19
Copy link
Owner

@mutantmonkey mutantmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions, comments, and requests inline. Please also fix this up to match the PEP8 formatting standards.

Since this relies on a web service, I would also like to see some tests here. Many of the existing modules already break on a regular basis due to web service API changes and I'd prefer to at least catch this if it happens.

'key': phenny.config.bash_api_key
}

web.post('https://bash.vtluug.org/quotes', {}, {}, True, json=quote_json)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to a config option.

@@ -0,0 +1,296 @@
#!/usr/bin/python3
"""
bash.py - bash.org clone. Saves quotes from quote-logger module to a db
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call this pyqdb? Calling it bash is confusing if it doesn't have API compatibility with bash.org.

global queue
queue.append(sqlite_data)

def bash(phenny, input):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how to use this at all. Can you please improve the documentation? Maybe add an example?


# Check Input Type
if not nick1_start_str.isdigit() or not nick2_end_str.isdigit():
phenny.say('Error: 2nd & 4th argument must be integers')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a user-friendly error message.

nick2_total = nick2_total + row[0]

if nick1_total < nick1_start:
phenny.say("Error: {} has not done {} actions ({} replies not included)" \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is not user-friendly.


bash.conn = None
bash.rule = (['bash', 'vtbash', 'quote'], r'(.*)')
logger.event = '*'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo, or is it supposed to be like this? If it's supposed to be like this, can you please add a comment explaining why?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants