From 1d1df7b540721d58db174764a0f720e3c638a67b Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Tue, 22 Jul 2025 08:23:22 +0300 Subject: Whitelist allowed inline bots Also update to Zig 0.14.1 Also don't send the animations rn --- src/Bot.zig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Bot.zig') diff --git a/src/Bot.zig b/src/Bot.zig index 8e69579..b0eb972 100644 --- a/src/Bot.zig +++ b/src/Bot.zig @@ -47,6 +47,10 @@ pub fn deinit(self: *Bot) void { self.* = undefined; } +pub inline fn deleteMessage(self: *Bot, args: types.DeleteMessageParams) !void { + (try self.post(bool, "deleteMessage", args)).deinit(); +} + pub inline fn editMessageText(self: *Bot, args: types.EditMessageTextParams) !Parsed(types.Message) { return self.post(types.Message, "editMessageText", args); } @@ -142,7 +146,7 @@ fn call( return res; } else |err| { std.log.warn("error when performing call: {}", .{err}); - if (tries == 20) { + if (tries == 4) { return err; } } @@ -218,9 +222,9 @@ fn wrappedCall( fn intoQueryString(allocator: Allocator, data: anytype) !?[]u8 { return switch (@typeInfo(@TypeOf(data))) { - .Null => null, - .Optional => if (data) |d| intoQueryString(allocator, d) else null, - .Struct => |s| { + .null => null, + .optional => if (data) |d| intoQueryString(allocator, d) else null, + .@"struct" => |s| { var sb = ArrayList(u8).init(allocator); defer sb.deinit(); -- cgit v1.2.3