### Connect to Discord Gateway and Reply to Mentions Source: https://pub.dev/packages/nyxx/documentation/packages/nyxx Demonstrates connecting to the Discord gateway using `Nyxx.connectGateway` with all unprivileged intents. It fetches the current bot user and sets up a listener for `onMessageCreate` events to reply when the bot is mentioned in a message. The example uses `MessageBuilder` and `MessageReferenceBuilder` for constructing and replying to messages. ```dart import 'package:nyxx/nyxx.dart'; void main() async { final client = await Nyxx.connectGateway('', GatewayIntents.allUnprivileged); final botUser = await client.users.fetchCurrentUser(); client.onMessageCreate.listen((event) async { if (event.mentions.contains(botUser)) { await event.message.channel.sendMessage(MessageBuilder( content: 'You mentioned me!', referencedMessage: MessageReferenceBuilder.reply(messageId: event.message.id), )); } }); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.