Is it possible to send the location from Telegram to Bot, which made in Bot Framework?
I send my location from my Telegram account to my Bot, but the server does not get them (I don't get the response).
Text messages send normal, and I get response from the server.
Code is very simple:
public async Task<Message> Post([FromBody]Message message)
{
return message.CreateReplyMessage("Tadaa");
}
Dang it, this is a bug. We are filtering out messages without content and we are not treating the location property as "content". To us it looks like no text, no attachments, no channeldata and so no reason to send the message. I will push through a fix.
Related
This is the code for messageCreate event that I wrote:
And in the discord app I am getting the response of the console log for no attachments even though I have tried sending images text and audio files:
You're most likely missing the MESSAGE_CONTENT intent.
Go to https://discord.com/developers/applications/ and enable the Message Content Intent in the Bot section.
Image for reference: https://i.imgur.com/mi8XMZb.jpg
Also make sure to add the GatewayIntentBits.MessageContent when you define your client.
I have created the bot in azure services using LUIS, which used as chatbot and can create conversations using dialogs.
At some point, I am trying to push messages to chatbot using Direct Line API 3.0, I'm using Postman to send the messages to bot.
I followed the instructions from this page, https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-send-activity?view=azure-bot-service-4.0
I'm able to send message to the conversation as bot, below is the image I sent message from Postman and got successful response.
But my issue is, after the message is sent, the bot tries to analyse even though it's not user message. Bot starts to send message from default message handler like below,
Even after sending the message successfully, my bot triggers the default message handler, which is expected only to happen for user messages but not for bot messages.
Also, I have checked with webchat channel, which it doesn't trigger this default message handler. This is happening only in DirectLine API, can anyone help me on this.
Instead of sending the message as type "message", you should send it as "event".
This way your MessagesController will see it as an ActivityType of Event instead of Message and you can process however you want without spaghettifying your actual message handling
If you want to send different kinds of event to make it even easier, then you can 'name' you event by supplying the 'name' field with a value in your json.
Third, if you need to include data with the message, you would supply a value in the 'value' field of your json.
The github page for the standard webchat client has some great information on sending events. It might shed a bit more light on the json.
You can read more about the 'event' activity type here
You message json would look something more like this:
{
"type": "event",
"from": {
"id": "user1"
},
"name": "theEvent",
"value": "someDataMyBotNeeds"
}
How can I send a message specifically to the user's private channel?
Use this:
await ctx.author.send(message_here)
It'll send the content of the variable message_here.
It works the same way as other .send()s in the respect of it still returns a message and you can send embeds and add a delete_after.
I was experimenting with a kik bot using Node.js, while I was trying to get a static keyboard to appear when user sends a 'help' message, it only sent the two replies and the static keyboard does not pop up. According to me it should work.
This is the function that sends the help messages:
/**
*
* #param {Message} message
*
*
*/
function help(message) {
message.reply('Hello!');
message.reply('Choose from the options to get an idea of what I can do! ;)');
message.addResponseKeyboard(['Rate me', 'Set reminder', 'Info']);
}
This is the bot configuration:
let bot = new Bot({
username: 'purppbot',
apiKey: 'dba843db-18bb-45fe-b6d6-3a678f420be2',
baseUrl: 'https://purppbot1-xbeastmode.c9users.io/',
staticKeyboard: new Bot.ResponseKeyboard(['Help', 'Info'])
});
I honestly don't know about Node.js; but as far as I see, I think you are expecting Static Keyboard to do what a Suggested Response Keyboard would do.
Regarding Static Keyboard, according to the API Reference of Kik docs, The static keyboard allows you to define a keyboard object that will be displayed when a user starts to mention your bot in a conversation, whilst regarding Suggested Response Keyboard, A suggested response keyboard presents a set of predefined options for the user.
It means the static keyboard is shown when a user starts to mention your bot in a conversation; and it disappears once a message is sent to the bot. And when the bot sends back a message to the user, it will contain its message(s) and Suggested Response Keyboard sent by the bot along with the message. In case no Suggested Response Keyboard is sent by the bot along with the message(s), the static keyboard is not shown until the user again starts to mention the bot's username.
So, in your case, you might want to send the those responses through Suggestive Responses Keyboard, which your bot would need to send along with the text message, every time a user sends the 'help' message.
I hope this helps.
I have a bot, and I can interact with it. And there's another bot, and I would like my bot to chat with that bot, when they are in the same channel. Is that even possible?
I tried to include a mention like <#IDBOT|name>: text, and even though it appears to me that the mention was successful, the other bot doesn't respond. If I post this mention it will work.
Is there a limitation here?
Yes, it can.
I had the same problem, it turns out that I had included some code that I didn't understand, and that code was preventing the response. I e-mailed slack about it and they set me straight.
The problematic code was this:
if event["type"] == "message" and not "subtype" in event:
user_id, message = parse_direct_mention(event["text"])
if user_id == self_id:
return message, event["channel"]
The helpful response from slack:
The condition below is what's preventing your bot from listening to bot's messages:
if event["type"] == "message" and not "subtype" in event:
When a message is sent by a bot, it will have a subtype, so this means that your logic is disregarding any bot message.
This is helpful because it prevents your bot from responding to its own messages, which would create an infinite loop.
You'll need to modify this condition so that your bot still "ignores" its own messages, but processes messages from other bots. You could do this for instance by looking at the bot ID or user ID and discarding those messages, but not messages from other bots.
In my case, I want the bot to respond to humans always, and bots only if they are trusted, so I did this:
from_user = "subtype" not in event
from_friend_bot = (event["subtype"] == "bot_message") and (event['username'] == f'{ping_source}')
if from_user or from_friend_bot:
user_id, message = parse_direct_mention(event["text"])
if user_id == self_id:
return message, event["channel"]
Yes, bots can talk to each other in a channel.
It depends on how you control the listening bot. I'm using a fork of the official Python Slackbot code (https://github.com/bscan/python-slackbot) and in it, I check for <#U1234567> where U1234567 is the user_id of the bot. When you mention #mybot, Slack replaces #mybot with <#U1234567> in the message. However, when posting as a bot, Slack doesn't replace a callout with the user_id. Instead, a bot can directly put <#U1234567> in the message (and post using as_user=True). Slack will display <#U1234567> as #mybot in the channel and the bot will be able to detect it if looking for that exact message string.
Source: played around until bots talked to each other.