In bot rewards (discord.py) by voting on top.gg / discordbotlist - python-3.x

When a user votes for my bot on either of the sites, it sends them a DM and I want it to do other things too but for the sake of simplicity can we use a print statement to be triggered once the user votes? is this going to be done using webhooks? I'm totally new to those.
Please give me an example code of how it could be done!

top.gg uses their own API, a full reference can be found here: https://top.gg/api/docs#pylib
You would first need to install their module which can be done with pip install dblpy
In their documentation, it shows many examples of usage and how you can implement them in your code. Simply all it does is, runs a task loop, waiting for a user to upvote, and within your code you can simply do what ever you want with the reward. As well as many other usages they provide, but hope this helps.

Related

Subscribe to google forms program submit without ownership

With the wake of the pandemic causing schools to go to distance learning, many classes take attendance by using a simple google form sent out to students to complete for each class everyday. While this seems like a simple solution, it is a pain for students to complete and keep track of. One way that I thought I could make this easier would be to keep track of which forms I have submitted everyday.
As of now, my problem is that I need a way to subscribe to the submit of a google form (based on a link). When that google form is submitted all I need to do is find a way to convey that to a program. What I do not understand is how I would be able to do that without having ownership of the form or make a teacher recreate the form. Is there a way that I can check if a google form has been submitted?
A couple of ideas I have had would be to sniff network traffic for a post request from a google form and get that link and compare it to other links in the program to see which one was submitted, but I would think there is an easier way to do this. Any ideas or code is welcomed.
I understand stack overflow is for already written code so if you do not agree with this post either ignore it or point me to the correct place where this should be posted. Thank you.

How to create a slackbot that notifies me if a post someone wrote is not answered after a period of time?

Hello this is my first time attempting to create a slackbot using this resource https://botkit.ai/ , the slackbot I am trying to create should notify me if someone' post on a slack channel is not answered after a period of time,say after 30 minutes
So far I have been able to make my slackbot respond to specific keywords
//make slackbot hear for specific keywords and then reply without directly being mentioned
let now = new Date()
controller.hears(['help', 'I need help', 'stuck', 'question'],['ambient'], function (bot,message) {
// do something to respond to message.
bot.reply(message,'Hello <#'+message.user+'> someone needs help!' );
});
At first I was hoping that botkit already had some time tracking features, but it doesn't seem like it does, how can I make my slackbot notify me of posts that have not been answered after a specific period of time??
I would look into storing state someplace. You can query for the messages in a channel and then store off when they were posted. Then, every minute (or more, depending on your needs), you can run through all those and see if they were answered. Now, it is going to be hard to know what "answered" means, unless you can control that answers are either:
in a thread keyed off the question
reference the original question via a link
tag the original question asker (and then you'd have an issue if someone asked two questions in a row)
marked with a token (like 'ANSWERED') (and then you'd have the same issue as the tag solution)
I can't think of any other way to associate an answer with a question.
Anyway, you can store off the time in a database, google spreadsheet or other solution (depending on where you are running your node code). I'm not familiar with botkit, but Transposit (disclosure, I work for them) has integration with Slack and with Google Sheets, and is free to use.

Google dialogflow how use dynamic response strings?

I'm trying to make a simple dialogflow conversation. I have made a simple conversation to ask a person who they are trying to call and then says if a person is available / unavailable, which is just a text reply. When a person is unavailable I have potentially 3 actions the user can do, leave a voicemail, redirect to a colleague or wait until the person is available.
The message I would return is
"I'm sorry nameOfPerson is not available, would you like to leave a voicemail message, redirect to a colleague or wait until nameOfPerson is available?"
Which works, but how can I make it so that lets say there is no voicemail the intent only response with, "I'm sorry nameOfPerson is not available, would you like to redirect to a colleague or wait until nameOfPerson is available?"
Currently the only way I see to fix this is making 7 intents with all different contexts like:
Intent1: voicemailContext
Intent2: redirectContext
Intent3: voicemailContext, redirectContext
Intent4: waitingContext
Intent5: WaitingContext, redirectContext
Intent6: waitingContext, voicemailContext
intent7: waitingContext,redirectContext, voicemailContext
All that work for just a small adjustment seems way to complicated. Also currently I'm sending those options in a call which I would much rather not since people could also just say those options and get a match
Dialogflow is very poor at handling logic. You can sorta do it, as you've seen, but this does lead to overly complicated models. One thing to remember that might help with this is that Intents are good at modeling what the user says, but that you're still responsible for what you do with that.
Better in many cases is to put the logic in a fulfillment webhook. This lets your code determine what the best response is and send that response. Depending how you want to structure your replies, you have a few other options:
You can send a context back in the reply. This would limit which Intents can get triggered when the user replies.
Another approach is to only have one Intent for the reply, but to use Entities to represent what sorts of things they can do. Then have your fulfillment, again, determine if they have given you a valid or invalid reply and respond accordingly.

Interpreting User Request with Actions On Google

Unless I've done something majorly stupid, it appears I only have one entry point into my Action on Google using Actions SDK and Node.js.
Consequently, I have to work out what the user has said by using some keywords with .indexOf() and then calling the appropriate function.
I thought that would also be simpler and there would be a way I could define an action with several phrases and Google would be intelligent enough to work it all out, even if the user said something slightly differently.
I guess one of the things Im doing wrong/different, is just by having a welcome intent that essentially has a conversation and asks "What would you like to do?" then the user responds, then I have to work out what was said, and follow up an appropriate action.
That seems quite long winded. Any better ways?
The "better way" is to use a tool that is designed for that and has a powerful and flexible Natural Language Processing engine associated with it. Actions directly support both Dialogflow and Converse.AI, and most other NLP engines should be able to provide information about how they work with Actions.
Dialogflow, for example, lets you specify some sample phrases that will meet an Intent, and then supplements that with "similar" phrases to the ones you've specified. Your Node.js webhook gets told which Intent was called, with what parameters you've specified for that Intent, and you can take action based on that information directly.
At this point, the Actions SDK is mostly intended to be used as the base that these and other NLP engines build on top of.

Trouble recognizing one word intents

I'm using wit to recognize different intents in a retail context. Some of them trigger (successfully) FAQ answers, other initiate a business logic.
Surprisingly, I'm having a lot of trouble with the most basics conversational intents, like answering a hi or hello. Specially if they come as a single word (it doesn't get hi or hello but it successfully returns the correct intent for hi buddy or hey dude). Obviously there's a high chance that the first thing an user would say is just a simple hello, any of you found the same issue? Any guidance on that?
It is actually the first time I experience this issue, and I haven't heard about it. Could it be related to the increasing number of intents created (now 15+)? I'm using trait as a search strategy.
Greetings intent
Click on image for a larger version of the image.
Thank you very much for your help,

Resources