Discord.py - How do I count the number of times a certain phrase has been used? - discord.py

I am trying to develop a bot using discord.py that will be able to go through the channel, count how many times a certain word is used, then give me the top X number of users that have said that phrase (in a given timeframe), along with the number of times that they have each said it.
So if I do !bump7, I want it to give me the top, say, 10 users that have said "bump" in the last 7 days
Or !hello10, which would give me the top 10 users that have said "hello" in the last 10 days.
The message would look something like...
Billybob 34 times
Cathrynaloha 27 times
Suzy 3 times
JohnDoe 2 times
I have the bot connected to the discord server, but I can't seem to figure out how to make this particular command work. And unfortunately no, I don't have anything in the works, as I'm just trying to search through here to see if anything similar has been done. So far, not a whole lot has been helpful. So any help on developing the client.command() would be awesome! Thank you!
-
I've actually tried really hard to do something similar to this person here: Discord.py: How to go through channel history and count the occurrences of a phrase?
However, it does not work at all, and I have no idea why. The conversation there is not exactly extensive, so I don't have a whole lot of context to work out anything. So re-opening/reiterating seems beneficial here
I've tried searching other areas in this site (and even a handful of other sites) to see if I can't troubleshoot it myself, but have run into too many walls. Guidance would be awesome.

Related

(Google Play) App dropped to rock bottom in multiple countries / top-lists after simple metadata change in a single country

Background info: Our game has been pretty stable for months in the top 100 roleplay category in over 55 countries while we've been hovering in the top 10 in around 5-8 countries.
Problem: After some metadata change (minor title & short description adjustments) in a few countries we've been immediately dropping like 100-400 positions in all countries (whether the country was involved in the metadata changes or not). We couldn't believe our eyes and were not able to wrap our head around how a ‘short description’ change in Poland can make us drop from #70 to #416 in the US-Roleplay charts. We dug through our data and we were able to find another similar occurrence. In June last year we exclusively changed the title of our game in France and immediately dropped 3x our ranking in 20 or more countries as well. In June all positions recovered over the timespan of 8 days, unfortunately it seems like this time this is not the case.
We’re aware of the importance of keywords and the impact metadata can have. We still rank very good on all our important keywords and the traffic coming from play store searches haven’t really changed as well.
Have any of you ever experienced this? What information are we missing? Looking forward to hearing your thoughts. Needless to say, we appreciate all input :)
We also faced something similar during the same time as you posted this message. To confirm, is your app title longer than 30 characters (do check all listings)? Google might have started to penalize for that. We are also figuring the same.
No luck with recovering the ranks

Purely Laravel: I would like to generate a key (token) on the page and then tell users to insert the key in a form in order to process the form

Who is asking? - Question is coming from less than 6 months old PHP developer who fell completely in love with PHP due to its awesomeness, also I just joined STACKOVERFLOW today 7th Dec, 2019.
Reason for the question: I have a form which I have completely built and validated with Laravel but I want to protect it from spam not with recaptcha but with a pin (a kind of generated key). I've seen it used on various websites and I also want to apply it.
Plan of action: The generated code will be placed at the end of the form with an input field and on filling it, it must match the code generated on every page refresh. If it doesn't match, I want to kill the page or perhaps, display a page with a "WELL DONE" message.
My thoughts: I'm new here and maybe the question might have been asked before, but honestly I've been on the computer for over a week (spending at least 18 hours searching and searching) but no really understandable solution.
What I can't do: Because I'm using Laravel, I don't know where to start this functionality and how to end it.
My helper: You are reading this and I believe you have the skills and techniques to help me without sweating at all. Just imagine a friend whose head is floating but the body is already in the ocean and about to drown. Also imagine a friend who has only one shot (2 days) to change his life, and if not done, only God knows what's to come. PLEASE HELP ME!
To everyone: Forgive me for the long message, I just believe that if I can express myself deeply enough, someone out there will help me out.
Thank you to all the awesome developers around the world.

AI single document search

I am trying to setup a system where I can undertake a search on a document so that any questions can be answered. For example, the document may be about visiting a city and include information like key sites and opening times. The user would be able to ask something like "What are the main places I should visit" or "what are the opening times of the X museum". The problem with this is that it is all very manual and any errors have to be picked up by me to manually fix. There is always only one document and it can be anything from 5 to 50 pages long. Does anyone know any AI tools that could help or how I could introduce self learning?
I have achieved this by creating a list of keywords (tags) against key facts. So the fact could be What are the Museum Opening times? and the keywords Museum and Time. I then undertake searches using AND and OR functions against the keywords. I have also created a database of pseudonyms e.g. for time I may have opening hours, times of opening etc.
What are the opening times of the X Museum?
The opening times of the museum are Monday to Friday 8am to 8pm
There is not an awful lot of detail in your question but it sounds like an application for a chat bot such as ALICE. To create a chat bot for your document you could use AIML.
Here is a tutorial for this :-
https://www.devdungeon.com/content/ai-chat-bot-python-aiml
Noting that I personally have never created such a thing it does seem that the functionality that you require is a good match to this technology.

Time attendance algorithm

I've recently started to work on Time attendance software. People are using cards to check in and check out, but sometimes they check out before they check in and then some of them realize they made mistake and check in again. sometimes they check in instead of check out. I wrote an application that creates report and everything works fine when mistakes are simple, but sometimes people are just people and they check in for example 15 times.
I know my question is kinda complex and I doubt there is and answer but I was wondering if there is any algorithm which can determine such mistakes and can create decent report.
thanks in advance.
I think really if you are trying to have your software guess what the users intent was then you would need to base it on what the users schedule should be and what their expected check in/out cycle looks like
If its a workplace and the users are punching in their time and they work 8 hour shifts, you could try to be smart and flag checkins 7.5-8.5 hours apart as probably a check in that should have been a check out. Then you could flag back to back checkins 23+ hours apart as probably a missed check out on the previous shift. 16 hour differences would still probably be impossible to guess because they could be clocking out for a double, or changing their schedule and working an earlier shift the next day.
If this was for a college building you could probably at least say that back to back checkins that occur on separate calendar days were a missed checkout.

Ways to enhance a trial user's first time experience

I am looking for some ideas on enhancing a trial-user's user experience when he uses a product for the first time. The product is aimed at a particular domain and has various features/workflows. Experienced users of the product naturally find interesting ways to combine features to get the results they want (somewhat like using an IDE from a programmer's perspective).Trial users get to use all features of the product in a limited fashion (For ex: If there is a search functionality, the trial-user might see only the top 20 results, or he may be allowed to search only a 100 times). My question is: What are the best ways to help a trial-user explore/understand the possibilities of the product in the trial period, especially in the first 20 - 60 mins before the user gives up on the product?
Edit 1: The product is a desktop app (served via JNLP, so no install required) and as pointed out in the comments, the expectations can be different in this case. That said, many webapps do take a virtual desktop form and so, all suggestions are welcome.
Check out how blinksale.com handles this. It's an invoicing app, but to prevent it from looking too empty for a new account, they show static images in places where you'd actually have content if you used the app. Makes it look less barren at first until you get your own data in.
if you can, avoid feature limiting a trial. it stops the user from experiencing what the product is ACTUALLY like. It also prevents a user from finding out if a feature actually works like they want/expect/need it to.
if you have a trial version, and you can, optimise it for first time use. focus on / highlight the features that allow the user to quickly and easily get benefits for useful output from the system.
allow users to export any data they enter into a trial system - and indicate that this is possible/easy. you don't want them to be put off from trying something because of a potential for wasted effort.
avoid users being required to do lots of configuration before using a trial. prepopulate settings based on typical/common/popular settings. you may also want to consider having default settings for different types of usage. e.g. "If you want to see what the system is like for scenario X, use configuration J. If you want to see what the system is like for use case Y, use configuration K." where J & K are collections of settings best suited to a particular type of usage.
I'll speak from personal experience while evaluating trial applications.
The most annoying trial applications are those which keep popping up nag screens or constantly reminding me that I'm using a trial. Trials which act exactly like the real product from the beginning till the end of the trial period are just awesome. Limited features are annoying, the only exception I can think of when you could use it is where you have rarely used feature which would allow people to exploit the trial (by using this "once-in-lifetime" needed feature and uninstalling). If you have for example video editing software trial which puts "trial" watermark on output, I'd uninstall it as soon as I'd notice it. In my opinion trial should seamlessly integrate into user work-flow so that once the trial ends they would think "Hey, I have been using this awesome program almost each day since I got the trial, I absolutely have to buy it." Sure some people will exploit it, but at the end you should target the group which will use your product in daily work-flow instead of one time users. Even if user "trials" it 2 times per year, he will keep coming back to your product and might even buy it after 2nd or 3rd "one-time use".
(Sorry for the wall of the text and rant)
As for how to improve the first session. I usually find my way around programs easily, but one time only pop-up/screen (or with check-box to never show it again) with videos showing off best features and intended work-flow are quite helpful. Also links to sample documents might be helpful. If your application can self-present itself (for example slide-show about the your slide-show program) you could include such document. People don't like to read long and boring help files, but if you have designer in your team, you could ask him to make a short colourful intro pdf. Also don't throw all the features at the user at the same time. Split information into simple categories and if user is interested into one specific category keep feeding him more specific information. That's why videos are so good, with 3-6 x ~3-5 minute videos you can tell a lot. Also depending how complex your program is you could include picture with information where specific things are located on the screen.
Just my personal opinion, I have never made a trial myself. Hope it helps.
An interactive walk through/lab exercise that really highlights the major and exciting offerings of your application.
Example: Yahoo mail does the same when the users opt to use new mail interface
There are so many ways you can go with this. I still can't claim to have found the best approach.
However, my plan from the beginning with my online (Silverlight) software was to give away something thousands of people will find useful and can use for free. The free version is pretty well representative of the professional product, with only a few features missing that enhance productivity (I'm working on those professional features now). And then I do have a nag popup that comes up every 5 minutes suggesting that you should buy it. That popup can be dismissed as many times as you want. I know that popup will annoy some people but I suppose that's the trade off. There is no perfect plan. But I don't think the occasional nag popup scares that many people away, especially when it can be dismissed with a single click.
I was inspired by Balsamiq Mockups, which has been hugely successful over the past couple years. My trial/nag popup way of doing things was copied almost exactly from Balsamiq. I honestly don't know if this is the ideal plan, but it has obviously worked for them. By the way, I think another reason for Balsamiq's success is that the demo doesn't have to be downloaded & installed. Since the demo is in Flash, there's a very high conversion rate of users actually trying it and becoming addicted to it.

Resources