discord.py (error code: 50027): Invalid Webhook Token - discord.py

I have a big problem.
I code discord bots with python using discord_slash. But since today, evey slash command that I make, it sends one message and then it sends an error saying:
discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token
So commands that sends 2 messages only sends one.
It does this to all my bots with slash commands.
This is an example of command that I make (just so you see it's a regular command):
#slash.slash(name = "Ping", description = "Check the bots time response")
async def ping(ctx):
embed = discord.Embed(title = "Pong.", description = f"**:chicken: `{int(bot.latency * 1000)}` ms**")
await ctx.send(embed = embed)
I tried reinstalling discord.py and it cannot be a token problem since it does the error on all my bots.
(I specify the fact that I checked many forums)
A help would be great thank you

It's not you, it's Discord...
Per their Discord Server (https://discord.gg/discord-developers):
Discord User — Today at 6:12 AM
Hi everyone. There is currently an issue being investigated with
interaction edits, deletes, and followups. This issue results in
receiving 50027: Invalid Webhook Token errors when trying to edit,
delete, follow up, or take some other actions on interaction webhooks.
Discord User — Today at 8:37 AM
Webhook token problem has been identified and we are working on
rolling out a fix. We will update this message when it is
resolved.]1
Discord User 2 — Today at 9:43 AM
The webhook token problem should be fixed.
As a reminder, we saw a Snowflake length increase to 19 characters
today! Snowflakes are 64 bit integers, so the max base 10 length is 20
digits now.

Related

I want to know how to access incoming messages of Telegram bot without having access to account that created the bot?

I lost access to my old telegram account that had a bot on it with some important stuff. There are still messages incoming on the bot on my old account. I still have the HTTP API token, and have heard that I can access the bot from another telegram account with the token as I have seen others do, but I do not know how. Basically I need access to see the messages my bot is sending to my old telegram account without actually having access to my old telegram account. Can someone please help me, I have tried using the localhost telegram bot source codes and stuff but have had no luck in figuring it out.
Do you still have the code?
If yes set a new webhook in this way, type online:
https://api.telegram.org/bot TOKEN /setWebhook?url=https:// THE SCRIPT ON YOUR HOST (USE HTTPS)
then insert at the end of the script:
switch($id){
case ' YOUR ID ': ## BE AWARE, ID IS NOT USERNAME, BUT AN AUTOGENERATED NUMBER STRING
$myfile = fopen('mymessages.txt', 'a+');
fwrite($myfile, $message); ## Put the name you gave to the variable which contains the message
fclose($myfile);
break;
}

Microsoft Bot send the response twice in Teams

I've used Microsoft bot framework SDKv4, and integrated to Teams channel. It is running well, but giving responses twice.
But, I didn't get the same behavior, while I tested it on Emulator and Web Chat in Azure Portal.
However, I can see below issue, while I ping the bot in web chat and get a response.
Further, I can also see, that its always 'sending' as a status although I got a valid response, and the status later changes to "Send Failed. Retry"
Is the issue related to my teams integration for getting message twice? and how, should I fix it!
Are you using webhooks? If so, having multiple webhooks with same ID could be the reason for double messages. Hope this helps
I made my bot working. It was the issue of MS authentication!
I had a call with MS support person and the root cause appeared to be only the MS authentication. Had to reset app secret and then re-deloyment.
Its weird that, although it was not getting authenticated primarily yet it was returning me the response. This, I still haven't got it!

Discord.py - Send message every day at a specific time

I'm having trouble trying to get my Discord BOT to send a message to the server at an exact time every day.
I am trying to get my discord BOT to send a message every day at a specific time.
For example: I want every day at 12:00, BOT will send a message to a channel with this message: "The server will be restarted in 5 minutes!".
I've searched all over the internet for this, none of the attempts I've had worked, I'm almost racking my brain here, can anyone help me?
You could try this Python package: https://pypi.org/project/schedule/
Simple make a function that uses the client to send a message to a specific channel by id.
I'm not sure how the Discord python library works, but I'm sure there's a way if you do some digging.
you can use the datetime library to do this, by making a loop and checking if the current time is equal to the time which you want the code to execute, I haven't used datetime in a while so I can't provide an example here but I have done it in my previous discord bots

Unable to get timestamp of the message posted by Slack App

Whenever my app posts ephemeral message to Slack channel (in response to a query by a user), I am unable to get the timestamp of my Slack app response. As I want to delete it once the user has made a selection using one of the buttons. Although I have subscribed to 'message.channels' event, I don't get a notification to my app whenever my app posts in the channel (in response to the user input), therefore, I am unable to get the timestamp of the message which I'll use to delete it. All I want is the timestamp of the message posted by my app so that I can delete it but I am unable to receive the timestamp. Please help!
For e.g. in Giphy app for Slack. Let's say the user invokes the app by calling '/giphy [dog]' where 'dog' is just an example of a search term. The app responds by sending a gif and user can either send it, shuffle to the next one or cancel it. I want a similar capability of cancelling the app response but I need the timestamp of the message in order to do so therefore I am asking for help.
Thanks.
Your approach can not work, because Slack is handling ephemeral messages differently from "normal" messages. They are only visible by one user and can not be modified by API methods (e.g. deletion).
But of course its possible to replace ephemeral messages. Here is how:
Your app can just reply to the interactive message request from Slack with a new message. That new message will by default override the original message including ephemeral messages.
You can reply in two ways:
Directly reply to the request from Slack with a message within 3 seconds
Send a message to the response_url from the Slack request within 30 minutes.
See here for the official documentation on how to respond to interactive messages.
This approach works both with interactive messages and slash commands.
See also this answer for a similar situation.

published bot keeps getting authentication error

I have a bot that's published online on facebook , each 2 days the bot stops working , when I open the bot framework I see this error
I click on edit messenger link and resubmit and then it works fine again . I am not sure what this error means and why it's happening
A task was canceled typically means the bot did not respond within the time expected. Too many errors, and then Facebook disables the bot and you have to resubmit.
Does your bot take a significant amount of time to respond to the request? Alternately, are there any paths where the incoming request is not responded to with a success code (letting bot framework know the message was received)?

Resources