If anyone has any advice for me, I would greatly appreciate it. I'm trying to write a program in Go, with a goal to keep it modular.

It's basic goal is to do two things:
1. Gather data from a public API and cache it in a database, occasionally refreshing this data.
2. Communicate with certain chat services as a bot, accepting queries for data and, for some of the info, sending notifications via those bots when there is a status change.

My idea was to split it into three portions.


1. API: a Golang library for the specific API I am tracking. I've actually done this already.

2. Engine: uses my API library to get data, store it in a database. Also accept queries from the Clients below to return data (e.g. is ___ online right now?) then send back what the Client should send to its service (e.g. Discord or IRC). Also, it needs to keep track of status changes (e.g. ___ has just gone offline, tell the IRC Client to send a message saying that).

3. The Clients: ...



3. The Clients (e.g. IRC bot, Discord bot, Telegram bot): facilitates the communication between the Engine and end users.

The main problem: I can easily create a program that does all this for just one of those end points (e.g. one for Discord). I can create multiple versions for each of them. But then, to run them, each would have to query the original API by themselves. I'd rather have one central Engine be able to communicate with multiple Client bots.


I guess, I'm just trying to figure out how I could have multiple of these bot handling programs communicate with one backend for it.

Ideally, this would all be using a Go embedded database instead of some external db like MongoDB.


Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.