Coder Social home page Coder Social logo

dotnet-sdk's Introduction

DBL-dotnet-Library

top.gg botlist wrapper

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

IDblSelfBot me = await DblApi.GetMeAsync();
// Update stats sharded   indexShard shardCount shards
await me.UpdateStatsAsync(24,        50,        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

Download

Nuget

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

Install-Package DiscordBotsList.Api

dotnet-sdk's People

Contributors

abnersquared avatar faith-ie avatar mylorik avatar null8626 avatar sei4or avatar th0mk avatar tonkku107 avatar velddev avatar xwilarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-sdk's Issues

Only 2 shards out of 4 are getting updated

I have two clusters, one updating shards from 0 to 1 and the other updating shards from 2 to 3. However, it seems only the latter is working. I am getting no errors. The Top.GG page only has 2 shards and the guild count of the shards 2 and 3.

This is how I update the stats:
await me.UpdateStatsAsync(FirstShard, TotalShardsInBot, guildCounts.ToArray());

First cluster:
FirstShard = 0
TotalShardsInBot = 4
guildCounts -> a list containing two numbers

Second cluster:
FirstShard = 2
TotalShardsInBot = 4
guildCounts -> a list containing two numbers

Can anyone help me? What am I doing wrong?
Thanks

How do I actually use the shard counting?

I was trying to implement the shard counting today, but it seems a bit complicated.
I know that indexShard is the shard you are posting from, shardCount is how many shards, and shards is a array of numbers that says how many servers are on each shard.
Except I don't have a specific shard that I'm posting from, and this doesn't sound the same as the docs.

Is it maybe an idea to add examples for people that use Discord.NET on how to use this (with DiscordShardedClient)? Because I also searched github and I didn't find anyone that actually implemented this successfully.

UpdateStatsAsync Overloads Not Clear

There is an overload of UpdateStatsAsync that accepts int, int, array. What are these parameters supposed to be? The two int seem to be the same value, and I'm not sure what is expected in the array.

Unexpected character met when parsing the API

Hello,
I've noticed that times to times the json serializer fails when trying to read received payloads. I get the following exception:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Miki.Net.Http.HttpClient.SendAsync[T](RequestMethod method, String url, String value)
   at Miki.Net.Http.HttpClient.GetAsync[T](String url)
   at DiscordBotsList.Api.DiscordBotListApi.GetAsync[T](String url)
   at DiscordBotsList.Api.DiscordBotListApi.GetBotAsync[T](UInt64 id)
   at DiscordBotsList.Api.AuthDiscordBotListApi.GetMeAsync()
   at Energize.EnergizeClient.UpdateDBLServerCount() in /home/earu/Energize/Energize/EnergizeClient.cs:line 110
   at Energize.EnergizeClient.<InitializeAsync>b__31_0(Object arg) in /home/earu/Energize/Energize/EnergizeClient.cs:line 136
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---

Here are the calls that caused the above exception:

            int servercount = this.DiscordClient.Guilds.Count;
            if (!this.IsDevEnv)
            {
                IDblSelfBot me = await this._DiscordBotList.GetMeAsync();
                await me.UpdateStatsAsync(servercount);
            }

You can find the up-to-date code at https://github.com/Earu/Energize/blob/master/Energize/EnergizeClient.cs#L105

This most likely happen when the API is down or unreachable.

High number of dependencies

Hi,

So I wanted to use this library for one of my project but there is an inside number of dependencies and I don't understand why they are here:
image

I'm not sure where they are coming from but looking at the csproj there should only be a dependency to Newtonsoft.Json

Update nuget package

Would be nice if the nuget package could be updated with the latest version of the master branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.