A Discord Bot List API binding for Dart
dbldart is a simple Discord Bot List API binding for Dart. It supports statistic updating, resource information fetching, and webhook vote monitoring. It is designed to be easy-to-use and easy to implement.
Add the library to your pubspec.yaml
.
You can specify a token...
DblBot dbl = new DblBot("<your dbl token goes here>");
or not...
DblBot dbl = new DblBot();
Not specifying a token will only grant access to API methods that don't require authorization.
You can update stats with a server count number...
dbl.updateStats(myBot.guilds.length);
or update them with an array of counts representing shards...
dbl.updateShardsStats(myBot.shards.map((s) => s.guilds.length));
Just create the webhook within the bot instance...
await dbl.webhook.create(12345, "my password");
dbl.webhook.onUserVote.listen((vote) {
print("user with id ${vote.userId} voted!")
});
and register the address on DBL accordingly. In this instance, http://yourip:12345
and set the password to my password
.
You can get bot information...
Bot dblBot = dbl.getBot(myBot.currentUser.id);
print(dblBot.monthlyVotes);
or get user information...
User dblUser = dbl.getUser(80047598504783872);
print(dblUser.social.twitterUrl);
You can make a big widget...
LargeWidget widget = new LargeWidget(myBot.id);
String url = widget.uri.toString();
or a small widget...
SmallWidget widget = new SmallWidget(myBot.id, SmallWidgetType.upvotes);
String url = widget.uri.toString();
Add this to your package's pubspec.yaml file:
dependencies:
dbldart: ^0.1.5
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:dbldart/dbldart.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.1.5 | Jun 4, 2018 |
|
|
0.1.4 | Jun 2, 2018 |
|
|
0.1.3 | Jun 2, 2018 |
|
|
0.1.2 | Jun 2, 2018 |
|
|
0.1.1 | Jun 2, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
0
|
Health:
Code health derived from static analysis.
[more]
|
--
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
--
|
Overall:
Weighted score of the above.
[more]
|
0
|
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in pubspec.yaml
.
The SDK constraint in pubspec.yaml
doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
Make sure dartdoc
successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.20.1 <2.0.0 |