Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 36 #49

Closed
wants to merge 14 commits into from
Closed

fix 36 #49

wants to merge 14 commits into from

Conversation

@Grommers00
Copy link

Grommers00 commented Oct 14, 2019

I've updated it to include code that will get a list of your messages by user-name and message.

It should only display locally, but will let you reference them.

tmessage/db.py Outdated Show resolved Hide resolved
tmessage/db.py Outdated Show resolved Hide resolved
tmessage/db.py Outdated Show resolved Hide resolved
tmessage/db.py Show resolved Hide resolved
@pep8speaks

This comment has been minimized.

Copy link

pep8speaks commented Oct 14, 2019

Hello @Grommers00! Thanks for updating this PR.

Line 19:1: E302 expected 2 blank lines, found 1

Comment last updated at 2019-10-15 13:43:18 UTC
tmessage/db.py Show resolved Hide resolved
@Shanmugapriya03

This comment has been minimized.

Copy link
Collaborator

Shanmugapriya03 commented Oct 15, 2019

@Grommers00 Can you fix the linting issues as mentioned here

@@ -80,6 +80,10 @@ def main():
pub_msg = f'[{user_name}] {displayed_name}: {raw_msg}'
if raw_msg != '':
MQTT_CLIENT.publish(MQTT_TOPIC, pub_msg)
if raw_msg == "grab":
query = grab_messages(CURRENT_USER)

This comment has been minimized.

Copy link
@hound

hound bot Oct 15, 2019

'grab_messages' may be undefined, or defined from star imports: db

@@ -4,7 +4,7 @@
import paho.mqtt.client as mqtt
from colorama import init, deinit, Fore, Back, Style
import tmessage.auth as auth # auth.py
from tmessage.db import store_messages # db.py
from db import * # db.py"""

This comment has been minimized.

Copy link
@hound

hound bot Oct 15, 2019

'from db import *' used; unable to detect undefined names

Grommers00 added 2 commits Oct 15, 2019
def grab_messages(user):
"""Grab messages from the user"""
cursor = MESSAGES_DB.execute_sql(
"SELECT sender, message FROM message where sender LIKE \'"+ user +'\'')

This comment has been minimized.

Copy link
@hound

hound bot Oct 15, 2019

missing whitespace around operator

Grommers00 added 3 commits Oct 15, 2019
"""Grab messages from the user"""
cursor = MESSAGES_DB.execute_sql(
"SELECT sender, message FROM message where sender LIKE \'" + user + '\'')
return [r for r in cursor.fetchall()]

This comment has been minimized.

Copy link
@hound

hound bot Oct 15, 2019

trailing whitespace

Grommers00 added 3 commits Oct 15, 2019
@Grommers00

This comment has been minimized.

Copy link
Author

Grommers00 commented Oct 15, 2019

wooo, i think I got it. Sorry first time using lint and python :)

@Haider8

This comment has been minimized.

Copy link
Owner

Haider8 commented Oct 15, 2019

@Grommers00 Please describe the changes done by you briefly so I can test this PR.

tmessage/cli.py Outdated Show resolved Hide resolved
Co-Authored-By: Haider Ali <haider.lee23@gmail.com>
@Grommers00

This comment has been minimized.

Copy link
Author

Grommers00 commented Oct 15, 2019

So what this function does if if you type 'grab' in the command line, it will grab a list of everything you've said previously. I figured this would be an easy way for you to quickly grab a list of everything you've said that was stored in the database. I added a function that goes into the SQL database and grabs it all based on the author. Theoretically this would be the foundation to more code being added that would allow for you to grab on date, etc, or many other ways to grab conversations, there's alot of potential.

@Haider8

This comment has been minimized.

Copy link
Owner

Haider8 commented Oct 15, 2019

@Grommers00 What command should I type exactly?

I am having this error right now on giving grab command

No command 'grab' found
@Grommers00

This comment has been minimized.

Copy link
Author

Grommers00 commented Oct 15, 2019

Ah - are you logging in utilizing the --user "username"?

@Haider8

This comment has been minimized.

Copy link
Owner

Haider8 commented Oct 15, 2019

@Grommers00 I appreciate the work done by you here. But what we want is a command like tmessage --messages which will show us all the messages which are stored in the database through paging. For paging, we can use this library here.

@Grommers00 Grommers00 closed this Oct 15, 2019
@Grommers00 Grommers00 deleted the Grommers00:message_list_add branch Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.