bisonrelay bot development decred

Bison Bot Kit

4 min read
Bison Bot Kit

Introduction

I’m building bison bot kit, a tool designed to simplify creating bots for the Bison Relay network.

What is Bison Relay

Bison Relay is an amazing piece of tech, provided by Decred. Bison Relay is basically a communication tool, with built-in social and economic factors.

BR Screen

Users can talk with each other. They can post in a feed and share with whom they are connected. You can tip users, and buy from stores created by other users.

What is a Bison Bot

Bison bots are bots that exist on the Bison Relay network. There are already some bots running, for example, the gc bot, which is a bot for keeping communication between users from other platforms, like Element (old matrix) and Discord. There is the cmsbot, which contractors use for sending invoices and getting paid, the pongbot, which coordinates pong games between two players with betting functionality, and some others.

What is Bison Bot Kit

Currently, building a bot for Bison Relay might be a challenge for many users, as you would need knowledge in many areas. I am creating the Bison Bot Kit as a first step for making bot creation easier for users.

Why Use

As the saying goes an image is worth more than a thousand words, so here it is:

Why to use Bison Bot Kit

This is my Pull Request (PR) from the pong repo, after adding bisonbotkit. It is a great tool and will save you some time.

For the more technical

If you are not a very technical person, you can skip this part.

So, one of the big advantages of using bison bot kit is that you will get access to a bot with all methods the Bison Relay(BR) rpcclient has access to.

This is amazing because it is basically a bot with a bunch of things (like payment and message built in!).

Look how simple it is for a bot that will listen for messages received, for example:

pmChan := make(chan types.ReceivedPM)
cfg.PMChan = pmChan
cfg.PMLog = logBackend.Logger("PM")

// Create new bot instance
bot, err := bisonbotkit.NewBot(cfg, logBackend)
if err != nil {
  return fmt.Errorf("failed to create bot: %v", err)
}

go func() {
  for pm := range pmChan {
    log.Infof("Received PM from %s: %s", pm.Nick, pm.Msg)
    // handle the received pm here
  }
}()

With this channel, you can listen for all messages the bot will receive and do what you want with them.

So if you want to pay or send a dm you can simply:

// 0.001 DCR
bot.PayTip(ctx, userID, dcrutil.Amount(1000000), 3)
msg := fmt.Sprintf("Congratulations! You received %.8f DCR", dcrutil.Amount(1000000).ToCoin())
bot.SendPM(ctx, userID.String(), msg)

The future and possibilities

Well, beyond some technical difficulties, the future is bright. Possibilities for building bots are vast and are basically limited by creators’ imagination.

One of the reasons Bison Relay was created is to fix some aspects that are fundamentally broken on the web

So, the future is to build anything that already exists on the web, plus anything else that we can! Isn’t that amazing?

What to expect

Currently, I am using the Bison Bot Kit for building the poker, which will be integrated with Decred.

But options are vast, some examples from the top of my head:

  • Block Explorer in a chat: A chat-based “block explorer” that provides real-time updates on the Decred blockchain—such as new blocks, transaction statuses, percentage stake, governance proposals.

  • Translation/Multilingual Bot: Bison Relay already has the ability for sending audios. That would fit perfectly with a bot that automatically translates messages on the fly, forwarding them based on each user’s preferred language.

  • Event/Calendar Bot: A scheduling and reminder tool that lets users query or subscribe to upcoming events, send out reminders, maintain RSVP lists, and even handle paid event tickets.

Conclusion

Working with Bison Relay has been an amazing experience, and it makes me believe the future of Decred is bright.

When Bison Relay first came out, it was really exciting for many people, and as it matures, it is looking even more exciting!

Looking forward to see what the future will bring us. So let’s build this future!