bot_list

Flexible, generic client for managing your bots stats on various bot listing providers discord discordcr
HEAD Latest release Yanked release released
z64/bot_list
3
Zac Nowicki

This repo seems to be no longer available at z64/bot_list.

Git synchronization failed . Last successful sync was .

Help find it again! … or have it archived.

bot_list

A shard for managing your Crystal bot's listings on multiple bot listing providers.

Write your own, or get started right away with https://top.gg or https://discord.bots.gg.

Installation

Add this to your application's shard.yml:

dependencies:
  bot_list:
    github: z64/bot_list

Usage

require "bot_list"

bot_list = BotList::Client.new(discord_client)

# Add some stock providers:
bot_list.add_provider("top.gg")
bot_list.add_provider("discord.bots.gg")

# Create a custom provider by implementing `name` and `update(cache)`:
class MyBotList < BotList::Provider
  def name
    "my custom bot listing"
  end

  def update(cache)
    payload = {guilds: cache.guilds.size}.to_json
    headers = HTTP::Headers{
      "Authorization" => ENV["MYBOTLIST_TOKEN"],
      "Content-Type": "application/json"
    }
    client_id = cache.resolve_current_user.id
    HTTP::Client.post("https://mybots.com/api/bots/#{client_id}", headers, payload)
  end
end

bot_list.add_provider(MyBotList.new)

# Update every provider with our stats every minute:
bot_list.update_every(1.minute)

# Update any time on-demand:
bot_list.update

Contributors

  • z64 Zac Nowicki - creator, maintainer
bot_list:
  github: z64/bot_list
  
License MIT
Crystal 0.34.0

Authors

Dependencies 1

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently