telegram bot payment BOT_PRECHECKOUT_TIMEOUT - bots

When paying in the bot (via payments Sberbank test and Yukassa test (didn't try other acquirers)), the bot responds to update with pre_checkout_query using answerPreCheckoutQuery and receives the response {"ok":true,"result":true}.
But the "BOT_PRECHECKOUT_TIMEOUT" error appears in the payment window. The error occurs on different accounts and different acquirers. The error occurs even if you perform the bot's actions manually.
Is that a problem on my side?
getting pre_checkout_query
answerPreCheckoutQuery
result

Related

Python3 Kraken Exchange Websockets AddOrder not working

I'm trying to send orders through websockets, but I don't know how to receive the response from the websocket as to whether it was successful or not. The site (https://support.kraken.com/hc/en-us/articles/360034936531-WebSocket-API-Trading-addOrder-and-cancelOrder) says that once the order had been sent, there will be a response outlining whether it was successful or not.
I'm just testing the addOrder with the following code:
async def test():
async for ws in websockets.connect("wss://ws-auth.kraken.com/"):
try:
token = generate_token()
request = {"event": "subscribe", "subscription": {"name": "addOrder", "token": token}}
await ws.send(json.dumps(request))
confirm_connection(await ws.recv())
confirm_subscription(await ws.recv())
volume = 0.0001
leverage = 0
ID = '12345'
request = {'event': 'addOrder', 'token': token, 'reqid': ID, 'ordertype': 'market', 'type': 'buy', 'pair': "XBT/USD", 'volume': volume, 'userref': ID, 'validate': 1}
resp1 = await ws.send(json.dumps(request))
resp2 = await ws.recv()
except websockets.ConnectionClosed:
continue
It connects to the websocket, makes a request for a test trade, sends that off. Then when I try to receive a response (line with resp2 = ...) it just says the following:
'{"errorMessage":"Public market data subscriptions are unavailable on this endpoint. Try ws.kraken.com","event":"subscriptionStatus","status":"error","subscription":{"name":"addOrder","token":"X"}}'
How are you supposed to receive the response as to whether Kraken received the trade request or not?
Thanks in advance
I have no experience with kraken websockets addOrder, but I do have experience with kraken addOrder api and kraken ownTrades and openOrders websocket subscriptions.
I'm guessing here, but judging from the error message, it looks like the error message is a response to a previous websocket subscription call you made requesting to subscribe to a channel data feed (not sure which one though).
With websockets, upon connection, you should get a systemStatus response message. In it, it contains the status ("online" is what you want to check for).
Next, depending on the subscription, you may receive a snapshot message pertaining to that service if it's online. That message will contain recent trade fills (ownTrades subscription), or currently open order (openOrders subscription). I haven't touched individual asset pair subscriptions, but I'm guessing recent activity there will be communicated as well.
I have no idea if anything I've stated herein will help you, but I do know this will definitely help you...
Contact kraken support by logging into your kraken account and then click on Support. I always open a support ticket (no chat, etc.) so that I can provide them with as much detail as I can including what I'm doing, how I'm doing it, and all error messages I'm getting back from them.
To date, they have responded in less than 24 hours and they've always given me very specific answers to my questions (there have been many questions). Overall, I would rate their support minimally 4.5 out of 5 stars.
Good luck.
I figured it out after some time, so this is for anyone else who has this issue.
There were no issues with websocket subscription, it was working as intended. Kraken does a weird thing where they send an error through the websocket, but it really is just a message and can be ignored. The websocket remains open and operational afterwards, so you just need to ignore the first response from the websocket.

How to check if the bot has the right to enter the voice Discord.js v13

I recently touched on the topic of checking for connection rights / talking in the bot, but it ignores and gives an error when writing a command
if (!message.guild.me.permissions.has('CONNECT'))
return message.channel.send(`I don't have rights`)
Error:
Cannot destroy VoiceConnection - it has already been destroyed
There was an Error while starting the Voice Stream```
The module I use is discord-music-player. Thanks in advance
Well first of all, your code only checks if the bot has connection perms in the guild, not if the bot can connect to the specific voice channel. Use channel.joinable to check for whether the bot can join the specific voice channel. Assuming you have the voice channel instance saved in the variable voiceChannel, here's an example:
if (!message.guild.me.permissions.has('CONNECT') || !voiceChannel.joinable) {
return message.channel.send(`I don't have rights`)
}
That answers your direct question of how to check if the bot can enter the voice channel.
However, the error Cannot destroy VoiceConnection - it has already been destroyed may not have anything to do with this question at all. It might be an entirely separate issue; if you are still getting this error after implementing the above solution, you need to ask a different question specifically about that error (and with the relevant code, which you did not include in this question).

Forwarding messages from Telegram Bot

I need to do the following:
user sends all kind of messages to my bot;
bot should forward the particular messages to my channel like this:
bot.forward_message(chat_id='my_chat_id', from_chat_id='my_chat_id_from_which_I_am_forwarding', message_id=message.message_id)
However, I am getting this error:
ERROR - init:__threaded_polling:515 - A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message to forward not found, 2021-03-09 18:44:15,950
When I debug this, message.message_id and message.text are correct. Does anybody have any ideas or suggestions?
bot.forward_message(
chat_id="#channel",
from_chat_id="chat_id_from_which_I_am_forwarding",
message_id=message.message_id)
You need to add the bot as admin in the channel!!

Dialogflow Webhook call failed. Error: [ResourceName error] Path '' does not match template

I am using Dialogflow ES and once I got the webhook setup, I haven't been having issues. But after a few months, I just started getting a random error. It seems to be inconsistent as in sometimes I get it for a specific web call and other times it works fine. This is from the Raw API response:
"webhookStatus": {
"code": 3,
"message": "Webhook call failed. Error: [ResourceName error] Path '' does not match template 'projects/{project_id=*}/locations/{location_id=*}/agent/environments/{environment_id=*}/users/{user_id=*}/sessions/{session_id=*}/contexts/{context_id=*}'.."
}
The webhook is in GCP Functions in the same project. I have a simple "ping" function in the same agent that calls the webhook. That works properly and pings the function, records some notes in the function log (so I know the function is being called), and returns a response fine, so I know the webhook is connected and working for other intents in the same agent before and after I get the error above.
Other intents in the same agent work (and this one WAS working), but I get this error now. I also tried recreating the intent and I get the same behavior.
The project is linked to a billing account and I have been getting charged for it, so I don't think it is an issue with being on a trial or otherwise. Though the Dialogflow itself is in "trial", but the linked webhook function is billed.
Where can I find what this error means or where to look to resolve it?
After looking at this with fresh eyes, I found out what was happening.
The issue was a mal-formed output context. I was returning the bad output context sometimes (which explained why sometimes it worked and sometimes it didn't). Specifically, I was returning the parameters directly into the output context without the output context 'name' or 'parameters'. Everything looked like it was working and I didn't get any other errors, but apparently, when Dialogflow receives a bad web response, it generates the unhelpful error above.

Why Botframework bot only works only on Emulator and none of the other channels?

Bot Info
Bot handle: Medibot_medibuddy
App ID: dcda60fe-72d4-4796-a728-de8fa3aef2a5
SDK Platform: Node.js
SDK Version: Latest
Active Channels: WebChat, Facebook, Skype
Deployment Environment: Azure App Service
Issue Description
Our bot (Medibot, https://medibotmb.azurewebsites.net) has suddenly stopped working on all channels including WebChat. It works perfectly on Emulator though. We've been trying to debug this issue since days and have not been successful with any solutions/suggestions online. I've tried using Log stream and debug console to catch exceptions but there aren't any.
Code Example
The code is hosted in https://github.com/nirmalrayan/medibot
Reproduction Steps
Visit medibotmb.azurewebsites.net. This should open WebChat channel's index.html document.
The page tries to load for a long time and throws HTTP status: 500, HTTP subStatus: 1001, HTTP Reason: Internal Server Errror.
Bot framework displays the error message 'There was an error sending this message to your bot: HTTP status code GatewayTimeout' for Facebook and Web Chat channels.
Expected Behavior
Render index.html page with Web Chat iframe.
After the user sends first message, the bot welcomes with a hero card.
Actual Results
Nothing happens. The page does not get rendered. No exception in thrown in log stream while testing. Even botframework 'Test' does not throw any error in Azure app service log stream.
node.js
I don't see the iframe code in the index.html of https://medibotmb.azurewebsites.net

Resources