stdoat_extrautils 0.1.0 copy "stdoat_extrautils: ^0.1.0" to clipboard
stdoat_extrautils: ^0.1.0 copied to clipboard

An extention package for stdoat to use certain endpoints that is only usable through a user account and other extra endpoints.

example/example.dart

import 'dart:convert';
import 'dart:io';
import 'package:stdoat/stdoat.dart';
import 'package:stdoat_extrautils/stdoat_extrautils.dart';

void main() async {
	final String botToken = '';
	final client = StdoatClient(botToken, tokenType: TokenType.user);
	client.commandHandler.setPrefix('!');

	client.commandHandler.addCommand('invite', (StdoatClient client, Message message, List<String> args) async {
		final channel = await client.getChannel(message.channelId);
		if (channel?.serverId == null) {
			return client.sendMessage(message.channelId, content: 'This command must be used in a server channel.');
		}

		final invite = await client.selfCreateInvite(message.channelId);
		if (invite == null) {
			return client.sendMessage(message.channelId, content: 'An error occured while creating the invite link.');
		}

		final inviteLink = 'https://stt.gg/${invite.code}';
		client.sendMessage(
			message.channelId, 
			content: 'Here is a new invite link for this server:\n**$inviteLink**'
		);
	});

	await client.connect();
}
1
likes
150
points
11
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An extention package for stdoat to use certain endpoints that is only usable through a user account and other extra endpoints.

Repository

License

MIT (license)

Dependencies

stdoat, web_socket_channel

More

Packages that depend on stdoat_extrautils