Top.gg Documentation

/

Dotnet

Top.gg Dotnet library


Dotnet Library

The community-maintained .NET Library for Top.gg. If you experience any issues please submit an issue on Github.

Installation

Nuget

If you're using Nuget you can use find it with the ID DiscordBotsList.Api or use.

Install-Package DiscordBotsList.Api

Usage

Unauthorized API Usage

Setting Up

DiscordBotListApi DblApi = new DiscordBotListApi();

Getting Bots

//                            discord id
IBot bot = DblApi.GetBotAsync(160105994217586689);

Getting Users

//                              discord id
IUser bot = DblApi.GetUserAsync(121919449996460033);

Authorized API Usage

Setting Up

AuthDiscordBotListApi DblApi = new AuthDiscordBotListApi(BOT_DISCORD_ID, YOUR_TOKEN);

Updating Stats

ISelfBot me = await DblApi.GetMeAsync();
await me.UpdateStatsAsync(
  // indexShard
  24,
  // shardCount
  50,
  // shards
  new[] { 12, 421, 62, 241, 524, 534 }
);

// Update stats           guildCount
await me.UpdateStatsAsync(2133);

Widgets

string widgetUrl = new SmallWidgetOptions()
	.SetType(WidgetType.OWNER)
	.SetLeftColor(255, 255, 255)
	.Build(160105994217586689);

Generates the following: