Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example
Browse files Browse the repository at this point in the history
Lexedia committed Apr 25, 2024
1 parent 6f793de commit 2764ef6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion example/example.dart
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ void main() async {
// Sanitizing content makes it safe to send to Discord without triggering any mentions
client.onMessageCreate.listen((event) async {
if (event.message.content.startsWith('!sanitize')) {
event.message.channel.sendMessage(MessageBuilder(
await event.message.channel.sendMessage(MessageBuilder(
content: 'Sanitized content: ${await sanitizeContent(event.message.content, channel: event.message.channel)}',
));
}
@@ -67,5 +67,15 @@ ullamcorper morbi tincidunt ornare.
}
});

client.onMessageCreate.listen((event) async {
if (event.message.content.startsWith('!avatar') && event.message.mentions.isNotEmpty) {
// Display the first mentioned user's avatar with the specified size.
final user = event.message.mentions.first;
await event.message.channel.sendMessage(MessageBuilder(
content: 'Avatar URL: ${user.avatar.get(format: CdnFormat.jpeg, size: 3072)}',
));
}
});

// ...and more!
}

0 comments on commit 2764ef6

Please sign in to comment.