DiscordBotList v0.1.0 DiscordBotList.Struct.BotStats View Source

Module representing the bot stats from the DiscordBotList API.

Link to this section Summary

Types

The amount of servers the bot is in. If an Array it acts like shards. Required if shards is not defined.

The amount of shards the bot has.

The zero-indexed id of the shard posting. Makes server_count set the shard specific server count.

The amount of servers the bot is in per shard. Not required unless server_count is not defined.

t()

Functions

Import a value from the string map to the atom struct. This is used when they have different names.

Import from string map values to the struct where the string key of the map is same as the atom key of the struct.

Create an empty struct corresponding to the specified map and called module.

Extract the struct from the map - struct pipeline.

Get the stats about the bot. See DiscordBotList.Struct.Bot.get_single/1 for configs in the call.

Post the BotStats struct data to the server. You always needs to supply stats. To override the dault token and id see DiscordBotList.Struct.Bot.get_single/1.

Link to this section Types

Link to this type

server_count()

View Source
server_count() :: integer() | [integer()]

The amount of servers the bot is in. If an Array it acts like shards. Required if shards is not defined.

Link to this type

shard_count()

View Source
shard_count() :: integer()

The amount of shards the bot has.

Link to this type

shard_id()

View Source
shard_id() :: integer()

The zero-indexed id of the shard posting. Makes server_count set the shard specific server count.

The amount of servers the bot is in per shard. Not required unless server_count is not defined.

Link to this type

t()

View Source
t() :: %DiscordBotList.Struct.BotStats{
  server_count: integer(),
  shard_count: integer(),
  shard_id: integer(),
  shards: [integer()]
}

Link to this section Functions

Link to this function

add_data(arg, map_key, struct_key)

View Source
add_data(
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }},
  String.t(),
  atom()
) ::
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }}

Import a value from the string map to the atom struct. This is used when they have different names.

Link to this function

add_raws(arg, raws)

View Source
add_raws(
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }},
  [atom()]
) ::
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }}

Import from string map values to the struct where the string key of the map is same as the atom key of the struct.

Link to this function

create_empty!(map)

View Source
create_empty!(map()) ::
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }}

Create an empty struct corresponding to the specified map and called module.

Link to this function

extract_struct!(arg)

View Source
extract_struct!(
  {map(),
   %DiscordBotList.Struct.BotStats{
     server_count: term(),
     shard_count: term(),
     shard_id: term(),
     shards: term()
   }}
) :: %DiscordBotList.Struct.BotStats{
  server_count: term(),
  shard_count: term(),
  shard_id: term(),
  shards: term()
}

Extract the struct from the map - struct pipeline.

Link to this function

get_stats_about_bot(config \\ [])

View Source
get_stats_about_bot(keyword()) :: t()

Get the stats about the bot. See DiscordBotList.Struct.Bot.get_single/1 for configs in the call.

Link to this function

post_updated_data(config \\ [])

View Source
post_updated_data(keyword()) :: {:error, String.t() | atom()} | {:ok, nil}

Post the BotStats struct data to the server. You always needs to supply stats. To override the dault token and id see DiscordBotList.Struct.Bot.get_single/1.

## Examples iex> data = %DiscordBotList.Struct.BotStats{server_count: 10, shard_count: 5} iex> post_updated_data(stats: data)