diff options
| author | 2025-07-22 08:23:22 +0300 | |
|---|---|---|
| committer | 2025-07-22 08:23:22 +0300 | |
| commit | 1d1df7b540721d58db174764a0f720e3c638a67b (patch) | |
| tree | 44bbfc972dac04e32729a3065c90dea0334149d8 /src/Bot.zig | |
| parent | replace trimming with just checking if the string is whitespace (diff) | |
| download | ukkobot-1d1df7b540721d58db174764a0f720e3c638a67b.tar.gz ukkobot-1d1df7b540721d58db174764a0f720e3c638a67b.tar.xz ukkobot-1d1df7b540721d58db174764a0f720e3c638a67b.zip | |
Whitelist allowed inline bots
Also update to Zig 0.14.1
Also don't send the animations rn
Diffstat (limited to 'src/Bot.zig')
| -rw-r--r-- | src/Bot.zig | 12 |
1 files changed, 8 insertions, 4 deletions
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 { | |||
| 47 | self.* = undefined; | 47 | self.* = undefined; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | pub inline fn deleteMessage(self: *Bot, args: types.DeleteMessageParams) !void { | ||
| 51 | (try self.post(bool, "deleteMessage", args)).deinit(); | ||
| 52 | } | ||
| 53 | |||
| 50 | pub inline fn editMessageText(self: *Bot, args: types.EditMessageTextParams) !Parsed(types.Message) { | 54 | pub inline fn editMessageText(self: *Bot, args: types.EditMessageTextParams) !Parsed(types.Message) { |
| 51 | return self.post(types.Message, "editMessageText", args); | 55 | return self.post(types.Message, "editMessageText", args); |
| 52 | } | 56 | } |
| @@ -142,7 +146,7 @@ fn call( | |||
| 142 | return res; | 146 | return res; |
| 143 | } else |err| { | 147 | } else |err| { |
| 144 | std.log.warn("error when performing call: {}", .{err}); | 148 | std.log.warn("error when performing call: {}", .{err}); |
| 145 | if (tries == 20) { | 149 | if (tries == 4) { |
| 146 | return err; | 150 | return err; |
| 147 | } | 151 | } |
| 148 | } | 152 | } |
| @@ -218,9 +222,9 @@ fn wrappedCall( | |||
| 218 | 222 | ||
| 219 | fn intoQueryString(allocator: Allocator, data: anytype) !?[]u8 { | 223 | fn intoQueryString(allocator: Allocator, data: anytype) !?[]u8 { |
| 220 | return switch (@typeInfo(@TypeOf(data))) { | 224 | return switch (@typeInfo(@TypeOf(data))) { |
| 221 | .Null => null, | 225 | .null => null, |
| 222 | .Optional => if (data) |d| intoQueryString(allocator, d) else null, | 226 | .optional => if (data) |d| intoQueryString(allocator, d) else null, |
| 223 | .Struct => |s| { | 227 | .@"struct" => |s| { |
| 224 | var sb = ArrayList(u8).init(allocator); | 228 | var sb = ArrayList(u8).init(allocator); |
| 225 | defer sb.deinit(); | 229 | defer sb.deinit(); |
| 226 | 230 | ||