Telegram Plasma Bot

Some time ago Alien Valley submitted an AZ for 50,000 QSR to be used with the Telegram Plasma Bot. The bot was used by the community, but the bot has some issues. It fails frequently. I cannot get the code to run. Unfortunately, @alien-valley.io cannot support the bot at this time and he gave me the private key to the 50,000 QSR

What do you want me to do with this 50,000 QSR?

  • Hold onto the 50,000 QSR and wait for someone to fix the bot
  • Unfuse all plasma and return the 50,000 QSR to the AZ fund
0 voters

I think it’s 50K. TBH I have not looked.

1 Like

Would be good to get the bot back up and running, can we run a bounty (like 10% of the qsr) as reward for someone to get it running and support it? Then the rest can be used for fusing

@sumamu does this work?

Barely, but it wont be appropriate for the plasma bot anyway.
GPT-4 might be able to fix the plasma bot.
Try feeding the code into it and then asking it to fix the issues.

good idea. I’ll try that.

@0x3639 if you’re busy w other things I don’t mind taking a look at it too. No guarantee I figure it out though.

5 Likes

That would be great. I do think this is a useful tool. If you can get it working I’m happy to run on my infrastructure. I also think the fix would be eligible for an AZ.

I think we should consider adding a function that removes plasma automatically:

  1. Either remove it automatically after X hours, or
  2. FIFO when we run out of QSR. For example, once we have fused X QSR and are left with Y QSR left, we should automatically unfuse the first ZTS address in the DB allowing new users to fuse plasma.

Right now I think it just runs out of QSR and stops working. @coinselor and I were never able to get it to run. I’ll look for our prior conversations and post them here.

You can only cancel a fuse entry after 10 hours. So we could just make a thread that checks every hour and cancels all fuse entries that are cancellable.

This information should be included in the message sent to the user after a successful fuse: your plasma will expire in 10 hours. Come back if you need more.

1 Like

I tried bard to fix it. It was 100% WRONG.

May be the prompt needs to be more specific
It’s written in typescript isn’t?
Maybe gpt4 is more helpful

Try feeding the index.ts file to GPT4. Sometimes when you ask it to access a link directly, it just says it can access it, but it actually can’t unless you’re using a plugin.

From ChatGPT 4.0

Your TypeScript code seems to be mostly correct and well-organized. I can’t see any syntax errors or any issues that would cause immediate failures. However, without the context of the external modules and the database, it’s hard to definitively say if there are logical errors, data inconsistency issues, or potential runtime errors.

Here are a few general tips to improve the code:

  1. Type Assertion: You use msg.from!.id.toString() to convert the ID into a string. Here, you are asserting that msg.from is not undefined or null. This is dangerous if the from field is missing for any reason, as it will cause a runtime error. You should check if msg.from exists before accessing its properties.
  2. Promise Handling: In the main function, you are creating a new Promise that never resolves. This might not be what you want. If you want to keep the script running indefinitely, you can just remove the await new Promise(() => {}) line.
  3. Error Handling: The code could benefit from more robust error handling. For example, if any of the await statements fail, it could lead to unhandled promise rejection warnings. Consider wrapping your await statements in try-catch blocks to handle any errors that could be thrown.
  4. Commenting: Although your code is quite self-explanatory, adding more comments, especially for complex logic, would improve maintainability and readability.
  5. Data Validation: Validate the incoming data before processing it. For example, when parsing the address and amount in the fuse function, if either is invalid, you simply return an error message. It would be better to check if they’re valid before trying to parse them.
  6. Code Redundancy: In the list function, you are looping through user.entries twice. This could be optimized to a single loop.

Remember, these are just suggestions and may not necessarily apply depending on your exact use case or requirements. Always test your code thoroughly in various scenarios to ensure it behaves as expected.

maybe I can try in Github autopilot. I’ll try that next.

But which part of the code isn’t working? It is probably a logical error, so GPT4 won’t be able to identify it, but if we’d know the issue and described it to GPT4, it could implement the changes.

1 Like

I need to go back through the old posts. We cannot even get it to run. It throws multiple error messages. We will dig in and report back.

That is usually caused by an incompatible version of NodeJS. I recommend using NVM (Node Version Manager) and giving the following LTS versions of NodeJS a try: 12, 14, 16, 18.

I got it “running” using NVM to install NodeJS 16.20.0.

Haven’t tried any functionality yet. Waiting for node to sync (trying MoonBaze’s znnd + newest chrome extension big int patch).

What I’ve done:

  • Install NVM curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  • clone plasmabot repo
  • run nvm install 16
  • pm @BotFather /netbow to get the TELEGRAM_TOKEN
  • add token and rename .env.template to .env
  • add scripts property to package.json so we could “npm start” as suggested by GPT-4 :stuck_out_tongue:
"scripts": {
  "start": "ts-node src/index.ts",
  "test": "echo \"Error: no test specified\" && exit 1"
}
  • run znnd
  • run npm start

There are a lot of deprecated issues everywhere, but should be functional regardless.

3 Likes

awesome. I’ll try this out today.

The zenon.org dev will give it a try as well.