When guildUpdate is detected when updated with a server.
with discordGo
I want my bot to send a message to a channel. So when an authorized person makes changes to the server, I want a message to be sent to a particular channel only once, how can I do that?
Its logic is like an invitation bot. Instead of sending a message when the member logs in, it will only send a notification to a channel when the server is edited (updated). But I don't know as I am new to this coding language. :(
Related
I have a slack bot that is sending direct messages to users. I want to add a functionality that will delete the message automatically 10 minutes after it has been sent. Please help.
There is an api that is used to delete chat messages :
https://api.slack.com/methods/chat.delete
For your use case, you need to capture the channel & timestamp details from the response of message that was sent. Once the message is sent, wait for required time and then call 'chat.delete' api to delete the message.
I want to see the last post a bot makes to my channel through the API/https
I tried getUpdates and it only shows messages I sent to the bot. I'd like to see messages the bot broadcasts to my channel
https://api.telegram.org/botxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/getUpdates
The getUpdates method only retrieves messages that are sent to the bot by normal users. Bots cannot see other bot messages, that means it cannot see its own messages. However you can track messages sent by the bot in your code logic. E.g. in Node.js you would do something like:
bot.sendMessage(channelId, "The message sent to the channel").then(ctx => {
// ctx contains the details of the message sent to the channel
// you can do whatever you want with it
});
currently I am working to creating telegram bot. Now I required to know is there is any API to send info messages (like the one we get during a user is added r deleted in a group chat)
Thanks in advance
What you want to do can be done using answerCallbackQuery method.
But first of all you have to create a CallbackQuery using InlineKeyboardMarkup to create inline keyboards you can follow the steps in this link.
After creating the callback query you have to answer it using one of the codes below:
if (update.CallbackQuery.Data == "CQ1")
{
await Bot.AnswerCallbackQueryAsync(update.CallbackQuery.Id,"Text",true,null, 0);
}
This way the message will look like a message box and will disappear after the user taps on OK. But if you use the code below, the message will show up and disappear automatically after a few seconds.
else if (update.CallbackQuery.Data == "CQ2")
{
await Bot.AnswerCallbackQueryAsync(update.CallbackQuery.Id, "Text", false,null, 30);
}
By the way, messages that are shown at times like adding a user to a
group are service messages and theses kinds of message can only be
sent by telegram server.
If my suggestion does not fix your issue you can use pinMessage method
that sticks a single message to the top of the page in groups and
channels. But note that you can only pin one message to a channel
or group and for pinning another message firstly you should unpin the
previous one.
Currently there is no way to send such info messages.
And in my opinion, this feature is unlikely to be added in future because:
info messages usually tell you information about your chat; they are managed by telegram servers
therefore they should not be sent by Users
bot is an instance of User
The telegram documentation states:
Receipt of virtually all messages (with the exception of some purely
service ones as well as the plain-text messages used in the protocol
for creating an authorization key) must be acknowledged. This requires
the use of the following service message (not requiring an
acknowledgment):
msgs_ack#62d6b459 msg_ids:Vector long = MsgsAck;
This thread alludes to sending acks back to the server but not the mechanism by which those acks are sent. I attempted sending a MsgsAck and a msgs_ack to the server but they failed because those are data types, not constructors (methods). This leads me to two questions:
How does a telegram client send acks back to the server? (both individually and as part of a method call)
How does a telegram client differentiate between server responses that require an ack and those who don't? (it appears responses that include a req_msg_id require an ack, but I'd like confirmation)
The simple way to go about this is:
1) accumulate the msg_ids that you receive for from the server - those that need to be acknowledged as indicated in the documentation: these are all content related messages, not service messages
2) Every time you want to send new messages to the server, you could include your accumulated acknowledgment messages in a message container along with the messages you intend to send.
3) If you have accumulated msg_ids to be acknowledged for over a period say X minutes, without an opportunity to clear them via step 2) above, then you can simply send an acknowledgment message back to telegram wit the list of msg_ids to be acknowledged.
To send an acknowledgement use this:
msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck;
I'm working with Sendgrid to send out emails Async (in vb.net) and want to notify the user when the process is complete. What's the fastest/easiest way to do this? I'm still new to threads and don't know how to wait on a sendgrid task/thread to finish.
Thanks
You should be able to use the Await keyword, to cause the cause execution to stop until the message has been sent to SendGrid:
Dim response = Await YourAsyncDeliveryFunction(email)
' Do what you want
However, sending a message to SendGrid does not mean that it's in the user's inbox. The email still needs to be processed by SendGrid, sent to the user's email service provider, which in turn needs to process it and provide that to the user. So, it's near impossible to tell a user when an email is actually in their inbox. Most people just opt to tell users that they should receive an email shortly.