Bot don’t respond using rasa - rasa-nlu

Need help please.
My bot respond with correct answer during the online training, and when I confirm the answer he want to give, it works (use a custom action to asnwer). How ever when I try my bot with actual dialogue It don’t work.
the sénarion will be like:
User: Bonjour
Bot: Bonjour écrivez votre problème
User: mon probleme est: bla bla
Nothing from bot
This sénario is when trying to run the bot.
But before that when using online training the bot respond correctly with the custom action.
In my stories file I have something like:
## Generated Story -960033508281559891
bonjour
- utter_bonjour
confirmer
- utter_etape1
problème_site
- SendIntent_probleme_site
- utter_problème_site
So according to my story file the bot should do the action SendIntent_probleme_site. The class for this action is:
class SendIntent_probleme_site(Action):
def name(self):
return ‘SendIntent_probleme_site’
def run(self, dispatcher, tracker, domain):
message = tracker.latest_message.text
return [SlotSet(‘intent_probleme_site’, message)]
I do this to store the intent_probleme as a slot to use it later
Any help please? I also don’t know how to do something that tell me were is the problem like a log or exception, etc.
Thank you

Related

How do I make my discord bot copy and paste someone's message in python?

I am trying to make a command that has an interaction like this:
User: p.poesia (text) #user
Bot: (text copied)
#user, 2021
Please consider reading the discord.py documentation.
This is the basic code I made for you to run it.
#client.command()
async def poesia(ctx, text):
await ctx.send(text + str(ctx.author))

How do I use a webhook using an existing bot with discord.py

I am trying to make a webhook where when a specific yt user posts a video I want my bot to post an emded link and text, however the catch is I am trying to add this to an existing discord.py bot that does other functions. I am using 'If this then that' to create the webhook but I don't know URL to use on this page in the Then That section. Am I doing it wrong? Does anyone know how to do this?
Thanks
Maybe try this:
import requests
discord_webhook_url = 'webhook url'
Message = {
"content": "some stuff here"
}
requests.post(discord_webhook_url, data=Message)

Command not found error after changing virtual machine

Okay so I have a music bot code that was working before I switched to another virtual machine provider. All the requirements are exactly the same as in my previous virtual machine because I copy and pasted everything including the requirements.txt. The bot runs normally with 0 errors until I try to run any of the commands. It gave me this error:
discord.ext.commands.errors.CommandNotFound: Command "play" is not found
I've tried rolling back to the rewrite version I started the project on,
changed #client.command to #bot.command after assigning bot = commands.Bot(command_prefix='prefix')
#I've assigned client = discord.ext.commands
#client.command(name='play', aliases=['sing'])
async def play(self, ctx, *, search: str):
#then some code
update 1: Ran it as a cog and raised:
discord.ext.commands.errors.ExtensionFailed: Extension 'music' raised an error: TypeError: cogs must derive from Cog
update 2: No idea why rolling back the rewrite version didn't work though. Perhaps I didn't do it correctly.
Just simply run it as a cog.
Note that the way cogs work has been updated recently:
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
If you still want to run it as a standalone bot,
your bot should looks like something along the lines of:
from discord.ext.commands import Bot
bot = Bot("!")
#bot.command(name='play', aliases=['sing'])
async def play(ctx, *, search: str): # Note no self
#then some code
bot.run("token")
It's important that the bot that you run is the same bot that you register the commands with. You're also passing self to your bot even though it's not in a cog, which doesn't make sense.
Okay so I found the problem.
The bot doesnt work when I try to run it as a standalone bot.
The reason using it as a cog don't work the first time was because.
the way cogs work has been changed in discord.py rewrite.
These are the changes I made:
#in cogs/music.py
class Music:
#Code
#bot.event
async def on_ready():
print('Music bot online')
to
#in cogs/music.py
class Music(commands.Cog):
#Code
#commands.Cog.listener()
async def on_ready():
print('Music bot online')
Thank you to the legendary #PatrickHaugh for helping me figure this out.

Using MS Teams as Channel: Authentification Dialog (GetTokenDialog class from Microsoft.Bot.Builder.Dialogs) doesn't popup

How can I use the new authentification feature in Bot Builder with MS Teams?
There seems to be an issue with Teams (see Login user with MS Teams bot or https://github.com/Microsoft/BotBuilder/issues/2104), seems if this is not considered in GetTokenDialog?
Is there any chance to get around this?
Just found the reason why it won't work with Teams. In method Microsoft.Bot.Connector.Activity.CreateOAuthReplyAsync(), Parameter asSignInCard has to be set to True for MSTeams, then, the line new CardAction() { Title = buttonLabel, Value = link, Type = ActionTypes.Signin } has to be changed to new CardAction() { Title = buttonLabel, Value = link, Type = ActionTypes.OpenUrl } because MS Teams can obviously not deal with Action type Signin. Hope, the MS developers will fix that method soon.
There are a few things you need to do to get this to work. First you need to create a manifest file for your bot in teams and whitelist token.botframework.com. That is the first problem.
From teams itself in AppStudio you create a Manifest. I had to play around with this a little bit. In AppDetails... Let it generate a new ID. Just hit the button. The URLs really don't matter much for testing. The package name just needs to be unique so something like com.ilonatag.teams.test
In the bots section you plug in your MS AppId and a bot name. This is a the real MSAPPID from your bots MicrosoftAppId" value=" from web.config in your code.
Ok now in "finish->valid domains" I added token.botframework.com and also the URL for my bot just in case. so something like franktest.azurewebsites.net
This part is done but you are not quite done... in your messages controller you need to add this since Teams sends a different verification than the other clients.
if (message.Type == ActivityTypes.Invoke)
{
// Send teams Invoke along to the Dialog stack
if (message.IsTeamsVerificationInvoke())
{
await Conversation.SendAsync(message, () => new Dialogs.RootDialog());
}
}
It took me a bunch of going back and forth with Microsoft to get this sorted out.
This is a known problem using OAuthCard in MS Teams. To solve it, you can change the Button ActionType from signIn to openUrl using this solution on github

Rails: How to post on my main facebook page through API?

I have the following permissions:
create_note, email, offline_access, photo_upload, publish_stream, read_stream, share_item, status_update, manage_notifications, read_friendlists, video_upload, user_relationships, user_status, user_photos
I can do post on the user timeline (www.facebook.com/username) but I can't see how to post on the user's wall (www.facebook.com)
To post on the user timeline, I use a code something like:
if I need to attach an image to the post
client.put_connections("me", "feed", attachments, attachments)
and
if I don't need to attach an image to the post
client.put_connections("me", "links", attachments, attachments)
both are working nice, but none of them really publish the message on the wall (www.facebook.com as a logged in user)
So, I just wondering if it is a normal behaviour or am I just missing something?
Thank you.
The same behavior I can see for other users those are sharing update from API. I think it's normal and we need not to worry about it.
As per me : We can't not say this is required because getting our own feed in 'News Feed' section is not beneficial at all.

Resources