def checkInbox(apihandle): messages = apihandle.request("inbox", sort="unread")[u'response'][u'messages'] #already read, don't need to send a new txt #variables to make it look pretty c: unreadConvId = messages[0][u'convId'] message = apihandle.request("inbox", type="viewconv", id=unreadConvId)[u'response'][u'messages'] username = message[-1][u'senderName'] subject = messages[0][u'subject'] messageId = message[-1][u'messageId'] body = message[-1][u'body'] return (username, subject, stripHtmlTags(body), messageId)
def checkSubscriptions(self): subscriptions = self.apihandle.request("subscriptions")[u'response'][u'threads'] threads = [] for thread in subscriptions: threads.append([thread[u'threadTitle'],thread[u'threadId'], thread[u'lastPostId']]) if len(threads) == 0: return "No new Subscriptions" message = "" for title in threads: message += title[0]+"\n" posts = self.apihandle.request("forum", type="viewthread", threadid=title[1], postid=title[2])[u'response'][u'posts'] message+=posts[-1][u'body']+"\n" #I'm only doing it this in case I figure out how to get the bottom code working so meh whatever. ''' until I figure out how to get this to only add the last read posts it's pretty useless. for post in posts: message += post[u'body']+"\n" ''' return (stripHtmlTags(message))