Skip to content

Commit

Permalink
Added: 1 or 2-part parsing to 'get messages' & 'get user posts'. Adde…
Browse files Browse the repository at this point in the history
…d Pi.
  • Loading branch information
bazbt3 committed Dec 5, 2017
1 parent 3fefd97 commit 317a209
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Expand Up @@ -8,14 +8,18 @@
**Parallel project for the December pnut.io \#Hackathon:**
`ppmentions.py` created, from a suggestion by @schmidt_fu for a list of mutual mentions. No external documentation; the intention is to roll the code into the main app.

### 2017-12-04: v0.3.13 (Eh?!):
* Added: Rudimentary parsing of 1- or 2-part commands (choice-operand.) Created at the whim of the developer and for speed of implementation.
* Changed: A few tiny code updates.
### 2017-12-05: v0.3.14 (mmmm… pi):
* Added: `gm` get messages and `gup` get user posts now usable with 1 or 2-way parsing.
* Changed: -
* Deprecated: -
* Removed: -
* Fixed: -
* Security: -

### 2017-12-04: v0.3.13 (Eh?!):
* Added: Rudimentary parsing of 1- or 2-part commands (choice-operand.) Created at the whim of the developer and for speed of implementation.
* Changed: A few tiny code updates.

### 2017-12-03: v0.3.12 (Filing system):
* Added: Files menu (but may need a better command than `io`.)
* Added: Upload an image (from the `images/` folder within the app folder.)
Expand Down
34 changes: 17 additions & 17 deletions PigPen.py
Expand Up @@ -6,7 +6,7 @@
/ __// // //// __// ___ / // /
/_/ /_/ |_ //_/ |___//_//_/
/__/
v0.3.13 for Python 3.5
v0.3.14 for Python 3.5
Site, changelog: https://github.com/bazbt3/PigPen
Expand Down Expand Up @@ -151,8 +151,8 @@ def commandentry():
getinteractions()
elif choice == 'gm': # no
getmentions()
elif choice == 'gms': # no
getmessages()
elif choice == 'gms':
getmessages(operand)
elif choice == 'gp':
getpost(operand)
elif choice == 'gs': # no
Expand All @@ -163,15 +163,15 @@ def commandentry():
getthread(0)
elif choice == 'gu':
getuser(operand)
elif choice == 'gup': # no
getuserposts()
elif choice == 'gup':
getuserposts(operand)
elif choice == 'help': # no
menu()
elif choice == "io": # no
filesmenu()
elif choice == 'msg': # no
createmessage(True)
elif choice == 'p': # no
elif choice == 'p':
createpost(True)
elif choice == 'r': # no
replypost(0)
Expand Down Expand Up @@ -564,7 +564,7 @@ def getmentions():
postcontent = pnutpy.api.users_mentioned_posts(userid, count=retrievecount, include_raw=True)
displaypost(postcontent)

def getuserposts():
def getuserposts(userid):
"""
Get an account's posts.
Expand All @@ -573,9 +573,10 @@ def getuserposts():
User input:
User number.
"""
userid = input("User posts, userid? [return]=me: ")
if userid == '':
userid = "me"
if str(userid) == "":
userid = input("User posts, userid? [return]=me: ")
if userid == "":
userid = "me"
postcontent = pnutpy.api.users_posts(userid, count=retrievecount, include_raw=True)
displaypost(postcontent)

Expand Down Expand Up @@ -700,7 +701,7 @@ def getsubscribed(output):
pass
number -= 1

def getmessages():
def getmessages(channelnumber):
"""
Get a list of messages in a public channel, or a private channel the user has authorisation for.
Expand All @@ -709,12 +710,11 @@ def getmessages():
User input:
Channel number.
"""
global channelnumber
channelnumber = ""
while channelnumber == "":
channelnumber = input("-Messages in channel? [return]=list\n")
if channelnumber == "":
getsubscribed("")
if channelnumber == "":
while channelnumber == "":
channelnumber = input("-Messages in channel? [return]=list\n")
if channelnumber == "":
getsubscribed("")
postcontent = pnutpy.api.get_channel_messages(channelnumber, count = retrievecount, include_raw=True)
displaymessage(postcontent)

Expand Down

0 comments on commit 317a209

Please sign in to comment.