feat: payload для /start в ботах.
This commit is contained in:
@@ -412,6 +412,11 @@ class CachedMessage {
|
||||
this.editHistory,
|
||||
});
|
||||
|
||||
bool get isBotStartMarker {
|
||||
final control = attachments?.whereType<ControlAttachment>().firstOrNull;
|
||||
return control != null && control.isBotStart;
|
||||
}
|
||||
|
||||
CachedMessage copyWith({
|
||||
String? status,
|
||||
bool? deleted,
|
||||
@@ -809,6 +814,26 @@ class MessagesModule {
|
||||
return _api.sendRequest(Opcode.msgSend, payload);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>?> sendBotStart(
|
||||
int chatId,
|
||||
String startPayload,
|
||||
) async {
|
||||
final response = await _api.sendRequest(Opcode.msgSend, {
|
||||
'chatId': chatId,
|
||||
'message': {
|
||||
'cid': DateTime.now().millisecondsSinceEpoch * -1,
|
||||
'attaches': [
|
||||
{
|
||||
'_type': 'CONTROL',
|
||||
'event': ControlAttachment.botStartedEvent,
|
||||
'startPayload': startPayload,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
return _sentMessageMap(response);
|
||||
}
|
||||
|
||||
Future<String> _sendAndExtractMessageId(
|
||||
Map<String, dynamic> payload,
|
||||
String defaultError,
|
||||
|
||||
Reference in New Issue
Block a user