Discord bot used @okp4 to bridge the Dataverse!
This project is a general-purpose Discord bot around the Cosmos ecosystem that bridges Discord and the blockchains of that ecosystem.
The aim of the bot is to cover a wide range of features:
- requesting tokens for a testnet Cosmos (aka as Faucet feature) ;
- consultation of blockchain transactions ;
- consultation of wallet balances ;
- consultation of application states of modules or smart contracts ;
- interaction with smart-contracts ;
- ...
This bot is currently used for the OKP4 Discord server, providing the many features that help us keep the server running smoothly while providing many services to our community. The aim is to provide the following range of features:
- consultation of data spaces, including governance rules
- consultation of the progress of a workflow execution
- consultation of dataset and service metadata
- ...
Boot π the discord bot.
./discord_bot start --help
discord_bot-start
Boot the discord bot
USAGE:
discord_bot start [OPTIONS]
OPTIONS:
-g, --guild-id <GUILD_ID>
The guild ID (Server ID)
-h, --help
Print help information
-p, --prometheus-endpoint <PROMETHEUS_ENDPOINT>
The prometheus endpoint. Optional. Configures an HTTP exporter that functions as a
scrape endpoint for prometheus. The value is an IPv4 or IPv6 address and a port number,
separated by a colon. For instance: 0.0.0.0:9000
-t, --token <TOKEN>
The discord token
start -t MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.Zm9vYmFy.Fa_SK4L9Sdk4Ndk4Sl5ZLkrjs4fk456DHKsqED -g 1234567890123456789
The bot is configured using a toml
configuration file. Here is an example that configures the chain and the faucet (to be adapted to your needs):
[chain]
chain_id = "okp4-nemeton-1"
denom = "uknow"
grpc_address = "https://grpc.testnet.okp4.network"
prefix = "okp4"
batch_transaction_window = { secs = 15, nanos = 0 }
[faucet]
channel_id = 1034483599996620820
amount_send = 1000000
fee_amount = 0
gas_limit = 200000
memo = "Sent by ΓΈkp4 discord bot π€"
explorer_url = "https://explore.okp4.network/okp4%20testnet/tx/{txhash}"
If you want to expose Prometheus metrics you need to set the -p <PROMETHEUS_ENDPOINT>
to the command line:
start -t MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.Zm9vYmFy.Fa_SK4L9Sdk4Ndk4Sl5ZLkrjs4fk456DHKsqED -g 1234567890123456789 -p 127.0.0.1:9000
- type:
counter
- description: The total number of interactions received by the bot from Discord, labeled with: interaction, command.
- example:
discord_interactions_total{interaction="application-command",command="ping"} 96
- type:
histogram
- description: Timing statistics (percentiles) for Discord interaction processing durations, labeled with: interaction, command, quantile.
- example:
discord_interactions_duration{interaction="application-command",command="ping",quantile="0"} 0.36191104
discord_interactions_duration{interaction="application-command",command="ping",quantile="0.5"} 0.3619316097353429
discord_interactions_duration{interaction="application-command",command="ping",quantile="0.9"} 0.3619316097353429
discord_interactions_duration{interaction="application-command",command="ping",quantile="0.95"} 0.3619316097353429
discord_interactions_duration{interaction="application-command",command="ping",quantile="0.99"} 0.3619316097353429
discord_interactions_duration{interaction="application-command",command="ping",quantile="0.999"} 0.3619316097353429
discord_interactions_duration{interaction="application-command",command="ping",quantile="1"} 0.36191104
Be sure you have Rust properly installed with cargo-make.
cargo make
A docker image is also available. Usage example :
docker run okp4/discord-bot:latest start -t $TOKEN -g $GUILD_ID
Please check out OKP4 health files :