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

Scrap a channel and find the Roll number from the message and username with tag and put that in the google spreadsheet if not already present #9

Open
4 tasks
piyushchauhan opened this issue Jul 23, 2020 · 15 comments
Assignees

Comments

@piyushchauhan
Copy link
Owner

piyushchauhan commented Jul 23, 2020

For example see the messages in #intro channel of Cassiopeia server at https://discord.gg/NYHj58M
Steps:

  • Get the channel where !scrap rolls command is sent.
  • Go to that channel and get the past messages and check if it contains any roll number or not (use regular expression to find the roll number). If no roll number is found in that message move next message.
  • Store the username with tag in the spreadsheet matching to that corresponding roll number. If that roll number does not exist then send the message in that channel saying that roll number is not in the database and mention the moderator so that he can register his name also in the database.
  • Get the username with tag of the author from the message.

Column order in the spreadsheet

Discord username tag Real Name Roll Number email House Comments
@Darshilp326
Copy link

I would like to work on this issue.

@piyushchauhan
Copy link
Owner Author

@Darshilp326 Ok I am assigning it to you. You can start working on it.

@piyushchauhan
Copy link
Owner Author

piyushchauhan commented Jul 23, 2020

Make a new command for this task in new file. !scrap rolls

@piyushchauhan
Copy link
Owner Author

piyushchauhan commented Jul 28, 2020

One possibility to solve this. @Darshilp326

  1. get the list of all the people who are accessible to the channel in which !scrap rolls was sent.
  2. get all the messages from each person that was sent in that chennel.
  3. Perform the roll number reqular expression query on each message.

@Darshilp326
Copy link

Darshilp326 commented Jul 29, 2020

@piyushchauhan For 2nd step we need to fetch messages which will lead to older problem only.

@piyushchauhan
Copy link
Owner Author

@piyushchauhan For 2nd step we need to fetch messages which will lead to older problem only.

Most probably there won't be more than 100 msgs sent by a user in that channel. So that will work practically.

Anyways later on we can add a moderation to the channel that if the person who messaged is in the channel is already in the spreadsheet database then we can delete that message. So that it won't cause much over head in future.

@Darshilp326
Copy link

@piyushchauhan there is no inbuilt function for finding a specific user's message. We need to fetch all messages of that channel and then find manually by checking that message's author id and our user's id.

@Darshilp326
Copy link

@piyushchauhan one solution can be for every message we need to check if it contains roll no. But for this we don't need command !scrap-rolls.

@piyushchauhan
Copy link
Owner Author

Refer this https://support.discord.com/hc/en-us/articles/115000468588
If this is possible through Discrod.js then our job is done.

@piyushchauhan
Copy link
Owner Author

@piyushchauhan
Copy link
Owner Author

piyushchauhan commented Jul 29, 2020

Have you made the Regex for roll number?

@Darshilp326
Copy link

Darshilp326 commented Jul 29, 2020

^\d{4}[a-z]{2,}\d{1,3}$ regex

https://regex101.com/r/ck8jKo/21

@Darshilp326
Copy link

Message collector will work ! Actually without that also if we check every message then it is similar to message collector only.

@piyushchauhan
Copy link
Owner Author

^\d{4}[a-z]{2,}\d{1,3}$ regex

https://regex101.com/r/ck8jKo/21

\d{4}[a-z]{2}\d{2}
https://regex101.com/r/ck8jKo/22
This will be a better one. Always consider multiline strings when building regex

@Darshilp326
Copy link

^\d{4}[a-z]{2,}\d{1,3}$ regex
https://regex101.com/r/ck8jKo/21

\d{4}[a-z]{2}\d{2}
https://regex101.com/r/ck8jKo/22
This will be a better one. Always consider multiline strings when building regex

Ok i will take this but i have assumed that in one message we will be getting only one roll number

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

No branches or pull requests

2 participants