landart 1.4.0 copy "landart: ^1.4.0" to clipboard
landart: ^1.4.0 copied to clipboard

A featureful API wrapper for Lanyard & Lanyard KV written in Dart.

pub documentation

A featureful API wrapper for Lanyard & Lanyard KV written in Dart.

Features #

  • Get user's presence data
  • Subscribing to user presence
  • Access Lanyard KV

Getting started #

Make sure your target user already joined Lanyard's Discord server.
Check out Phineas/lanyard for more information.

Usage #

import 'package:landart/landart.dart';

void main() async {
  LanyardUser user = await Lanyard.fetchUser("someUserId");
  List<String> users = (await Lanyard.fetchMultiUser(
    ["someUserId1", "someUserId2", "someUserId3"]
  )).map((e) => e.discordUser.id).toList();
  
  (await Lanyard.subscribe(user.discordUser.id)).listen((user) {
    user.toObject();
  });
  (await Lanyard.subscribeMultiple(users)).listen((user) {
    user.values;
  });
  (await Lanyard.subscribeAll()).listen((user) {
    user.toObject();
  });

  LanyardKV kv = LanyardKV(
    userId: "someUserId",
    token: "someToken"
  );

  kv.token("someOtherToken");

  await kv.set("randomKey", "randomValue");
  await kv.setAll({
    "randomKey1": "randomValue1",
    "randomKey2": "randomValue2",
    "randomKey3": "randomValue3",
  });

  await kv.get("randomKey");
  await kv.getAll();

  await kv.delete("randomKey");
  await kv.deleteAll();
}
0
likes
140
pub points
0%
popularity

Publisher

verified publishernightfeather.dev

A featureful API wrapper for Lanyard & Lanyard KV written in Dart.

Repository (GitHub)
View/report issues

Topics

#discord #lanyard

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

archive, equatable, http, web_socket_channel

More

Packages that depend on landart