Skip to content

Eptagone/ShopBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShopBot

This is a Telegram bot imitation of @ShopBot made with NET 6.

This bot can do everything @ShopBot does, or well... almost everything. You won't be able to see the difference. If you're interested in how the Payment API works in Bots, this project can help you.

How to Run: Long Polling

You just need to specify your bot token and your payment provider token in the ShopBotNET.AppService project.

The provider token allows your bot to use the payment API. If you don't already have it, you can get one for testing by creating an account on stripe and enabling TEST mode. Then go to BotFather and get your token.

Your secrets.json or appsettings.json should look like the following code:

{
"Telegram": {
    "BotToken": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
    "Payments": {
      "ProviderToken": "123456789:TEST:XXXXXXXXXXXXXXXXX"
    }
  }
}

You can also use enviroment variables instead:

Env Description
Telegram__BotToken Your bot token provided by @BotFather.
Telegram__Payments__ProviderToken Your provider token.

Finally, run ShopBotNET.AppService and see the magic.

How to Run: Webhook

If you want to run this bot using a webhook, you must add two additional settings: the application url and a secret token in the ShopBotNET.Webhook project. Optionally, you can specify the certificate path to use with your webhook.

Your secrets.json or appsettings.json should look like the following code:

{
  "ApplicationUrl": "https://www.example.com",
  //"Certificate": "/etc/ssl/certs/custom_cert.pem",
  "Telegram": {
    "BotToken": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
    "SecretToken": "SUPERSECRETTOKEN",
    "Payments": {
      "ProviderToken": "123456789:TEST:XXXXXXXXXXXXXXXXX"
    }
  }
}

You can also use enviroment variables instead:

Env Description
ApplicationUrl Your application url. Ex: https://example.com
Certificate Optional. Certificate Path.
Telegram__BotToken Your bot token provided by @BotFather.
Telegram__SecretToken Your secret token. It must be specified by yourself.
Telegram__Payments__ProviderToken Your provider token.

Finally, run ShopBotNET.Webhook and see the magic.