Commit 99fe647b95

99fe647b95e31ce0e101020217de6b0b345ed0c5

parent: 1272f4576c

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-07-10 14:27 UTC
committer: <strk@kbt.io>

fix: run moderation requests asynchronously

Layout: unified · split

src/commands/moderation.rs +15 −14
@@ -111,8 +111,8 @@ impl ModerationCommand {
111111 let room = room.room().clone();
112112 let action = self.action;
113113 let error_user_id = user_id.clone();
114 let result = self.servers.runtime().block_on(async move {
115 match action {
114 Weechat::spawn(async move {
115 let result = match action {
116116 ModerationAction::Ban => {
117117 room.ban_user(&user_id, reason.as_deref()).await
118118 }
@@ -122,19 +122,20 @@ impl ModerationCommand {
122122 ModerationAction::Unban => {
123123 room.unban_user(&user_id, reason.as_deref()).await
124124 }
125 };
126
127 if let Err(error) = result {
128 Weechat::print(&format!(
129 "{}{}: Failed to {} {}: {}",
130 Weechat::prefix(Prefix::Error),
131 PLUGIN_NAME,
132 action.verb(),
133 error_user_id,
134 error
135 ));
125136 }
126 });
127
128 if let Err(error) = result {
129 Weechat::print(&format!(
130 "{}{}: Failed to {} {}: {}",
131 Weechat::prefix(Prefix::Error),
132 PLUGIN_NAME,
133 self.action.verb(),
134 error_user_id,
135 error
136 ));
137 }
137 })
138 .detach();
138139 }
139140}
140141