Skip to content

Commit

Permalink
🚦 Merge #257: Updated onStop method
Browse files Browse the repository at this point in the history
  • Loading branch information
HeySreelal authored Jun 21, 2024
2 parents a4e8995 + 3924e05 commit ea777be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/televerse/bot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ class Bot {
if (isServerless) return;
fetcher.onUpdate().listen(
_onUpdate,
onDone: () {
_onStop.call();
onDone: () async {
await _onStop.call();
},
);
try {
Expand Down Expand Up @@ -1480,12 +1480,12 @@ class Bot {
}

/// On Stop Handler
void Function() _onStop = () {};
FutureOr<void> Function() _onStop = () {};

/// Registers a callback when the the bot is stopped.
///
/// This can be used to clean up resources.
void onStop(void Function() callback) {
void onStop(FutureOr<void> Function() callback) {
_onStop = callback;
}

Expand Down

0 comments on commit ea777be

Please sign in to comment.