# Telegram Plasma Bot

**URL:** http://forum.zenon.org/t/telegram-plasma-bot/1434
**Category:** ╰  Funding  |  Submissions
**Tags:** in-progress
**Created:** [May 14, 2023, 12:48am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434 "2023-05-14T00:48:11Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 14, 2023, 12:48am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/1 "2023-05-14T00:48:11Z")

</div>

Some time ago Alien Valley submitted an AZ for 50,000 QSR to be used with the [Telegram Plasma Bot](https://forum2.zenon.org/t/telegram-plasma-bot-improvements/488). 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?

_Poll ([view on site](http://forum.zenon.org/t/telegram-plasma-bot/1434/1))_

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 14, 2023, 12:49am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/2 "2023-05-14T00:49:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![romeo](http://forum.zenon.org/user_avatar/forum.zenon.org/romeo/32/6_2.png) [@romeo](http://forum.zenon.org/u/romeo)
#### Post date: [May 14, 2023, 2:14am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/3 "2023-05-14T02:14:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sol](http://forum.zenon.org/user_avatar/forum.zenon.org/sol/32/1636_2.png) [@sol](http://forum.zenon.org/u/sol)
#### Post date: [May 14, 2023, 7:41am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/4 "2023-05-14T07:41:17Z")

</div>

@sumamu does this work?

> **[GitHub - HyperCore-Team/testnet-telegram-faucet](https://github.com/HyperCore-Team/testnet-telegram-faucet)**
>
> Contribute to HyperCore-Team/testnet-telegram-faucet development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![sumamu](http://forum.zenon.org/user_avatar/forum.zenon.org/sumamu/32/1869_2.png) [@sumamu](http://forum.zenon.org/u/sumamu)
#### Post date: [May 14, 2023, 9:53am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/5 "2023-05-14T09:53:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 14, 2023, 10:40am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/6 "2023-05-14T10:40:42Z")

</div>

good idea. I’ll try that.

---

<div class="post-metadata">

### Author: ![rexznn](http://forum.zenon.org/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@rexznn](http://forum.zenon.org/u/rexznn)
#### Post date: [May 14, 2023, 11:22pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/7 "2023-05-14T23:22:04Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 15, 2023, 12:54am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/8 "2023-05-15T00:54:23Z")

</div>

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.

> **[GitHub - alien-valley/plasma-bot](https://github.com/alien-valley/plasma-bot)**
>
> Contribute to alien-valley/plasma-bot development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![sumamu](http://forum.zenon.org/user_avatar/forum.zenon.org/sumamu/32/1869_2.png) [@sumamu](http://forum.zenon.org/u/sumamu)
#### Post date: [May 15, 2023, 9:20am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/9 "2023-05-15T09:20:09Z")

</div>

> [@0x3639](#):
>
> - Either remove it automatically after X hours, or

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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 15, 2023, 9:50am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/10 "2023-05-15T09:50:48Z")

</div>

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

 ![Screenshot 2023-05-15 at 4.50.02 AM](https://forum.zenon.org/uploads/default/original/2X/3/3837dc9cf564e732634a48cd4369f0df944be695.png)

---

<div class="post-metadata">

### Author: ![NeoShredder](http://forum.zenon.org/user_avatar/forum.zenon.org/neoshredder/32/221_2.png) [@NeoShredder](http://forum.zenon.org/u/NeoShredder)
#### Post date: [May 15, 2023, 11:25am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/11 "2023-05-15T11:25:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sumamu](http://forum.zenon.org/user_avatar/forum.zenon.org/sumamu/32/1869_2.png) [@sumamu](http://forum.zenon.org/u/sumamu)
#### Post date: [May 15, 2023, 3:03pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/12 "2023-05-15T15:03:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 15, 2023, 3:06pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/13 "2023-05-15T15:06:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 15, 2023, 3:06pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/14 "2023-05-15T15:06:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sumamu](http://forum.zenon.org/user_avatar/forum.zenon.org/sumamu/32/1869_2.png) [@sumamu](http://forum.zenon.org/u/sumamu)
#### Post date: [May 15, 2023, 3:12pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/15 "2023-05-15T15:12:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 15, 2023, 3:29pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/16 "2023-05-15T15:29:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sumamu](http://forum.zenon.org/user_avatar/forum.zenon.org/sumamu/32/1869_2.png) [@sumamu](http://forum.zenon.org/u/sumamu)
#### Post date: [May 15, 2023, 4:32pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/17 "2023-05-15T16:32:27Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![coinselor](http://forum.zenon.org/user_avatar/forum.zenon.org/coinselor/32/2832_2.png) [@coinselor](http://forum.zenon.org/u/coinselor)
#### Post date: [May 20, 2023, 1:47am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/18 "2023-05-20T01:47:52Z")

</div>

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

 ![image](https://forum.zenon.org/uploads/default/original/2X/f/f24ed8bac7cf2c2307e866ed9812fccd4228c26b.png)

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 😛

```auto
"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.

---

<div class="post-metadata">

### Author: ![0x3639](http://forum.zenon.org/user_avatar/forum.zenon.org/0x3639/32/1651_2.png) [@0x3639](http://forum.zenon.org/u/0x3639)
#### Post date: [May 20, 2023, 10:15am UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/19 "2023-05-20T10:15:11Z")

</div>

awesome. I’ll try this out today.

---

<div class="post-metadata">

### Author: ![mehowbrainz](http://forum.zenon.org/user_avatar/forum.zenon.org/mehowbrainz/32/1532_2.png) [@mehowbrainz](http://forum.zenon.org/u/mehowbrainz)
#### Post date: [May 22, 2023, 2:45pm UTC](http://forum.zenon.org/t/telegram-plasma-bot/1434/20 "2023-05-22T14:45:57Z")

</div>

The [zenon.org](http://zenon.org) dev will give it a try as well.

[Next page](http://forum.zenon.org/t/telegram-plasma-bot/1434.md?page=2)
