Skip to content

Commit 5d631c3

Browse files
committed
Apply fixes after testing new changes in develop.
1 parent 643d359 commit 5d631c3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/DB.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use Longman\TelegramBot\Entities\CallbackQuery;
1616
use Longman\TelegramBot\Entities\Chat;
17+
use Longman\TelegramBot\Entities\ChatJoinRequest;
1718
use Longman\TelegramBot\Entities\ChatMemberUpdated;
1819
use Longman\TelegramBot\Entities\ChosenInlineResult;
1920
use Longman\TelegramBot\Entities\InlineQuery;
@@ -146,6 +147,7 @@ protected static function defineTables(): void
146147
$tables = [
147148
'callback_query',
148149
'chat',
150+
'chat_join_request',
149151
'chat_member_updated',
150152
'chosen_inline_result',
151153
'edited_message',
@@ -351,7 +353,7 @@ protected static function insertTelegramUpdate(
351353
?string $chat_member_updated_id = null,
352354
?string $chat_join_request_id = null
353355
): ?bool {
354-
if ($message_id === null && $edited_message_id === null && $channel_post_id === null && $edited_channel_post_id === null && $inline_query_id === null && $chosen_inline_result_id === null && $callback_query_id === null && $shipping_query_id === null && $pre_checkout_query_id === null && $poll_id === null && $poll_answer_poll_id === null && $my_chat_member_updated_id === null && $chat_member_updated_id === null) {
356+
if ($message_id === null && $edited_message_id === null && $channel_post_id === null && $edited_channel_post_id === null && $inline_query_id === null && $chosen_inline_result_id === null && $callback_query_id === null && $shipping_query_id === null && $pre_checkout_query_id === null && $poll_id === null && $poll_answer_poll_id === null && $my_chat_member_updated_id === null && $chat_member_updated_id === null && $chat_join_request_id === null) {
355357
throw new TelegramException('message_id, edited_message_id, channel_post_id, edited_channel_post_id, inline_query_id, chosen_inline_result_id, callback_query_id, shipping_query_id, pre_checkout_query_id, poll_id, poll_answer_poll_id, my_chat_member_updated_id, chat_member_updated_id are all null');
356358
}
357359

@@ -1021,7 +1023,7 @@ public static function insertChatJoinRequestRequest(ChatJoinRequest $chat_join_r
10211023

10221024
try {
10231025
$sth = self::$pdo->prepare('
1024-
INSERT INTO `' . TB_CHAT_MEMBER_UPDATED . '`
1026+
INSERT INTO `' . TB_CHAT_JOIN_REQUEST . '`
10251027
(`chat_id`, `user_id`, `date`, `bio`, `invite_link`, `created_at`)
10261028
VALUES
10271029
(:chat_id, :user_id, :date, :bio, :invite_link, :created_at)

structure.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ CREATE TABLE IF NOT EXISTS `chat_join_request` (
267267
`chat_id` BIGINT NOT NULL COMMENT 'Chat to which the request was sent',
268268
`user_id` BIGINT NOT NULL COMMENT 'User that sent the join request',
269269
`date` TIMESTAMP NOT NULL COMMENT 'Date the request was sent in Unix time',
270-
`bio` TEXT NOT NULL COMMENT 'Optional. Bio of the user',
270+
`bio` TEXT NULL COMMENT 'Optional. Bio of the user',
271271
`invite_link` TEXT NULL COMMENT 'Optional. Chat invite link that was used by the user to send the join request',
272272
`created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
273273

utils/db-schema-update/0.74.0-unreleased.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS `chat_join_request` (
33
`chat_id` BIGINT NOT NULL COMMENT 'Chat to which the request was sent',
44
`user_id` BIGINT NOT NULL COMMENT 'User that sent the join request',
55
`date` TIMESTAMP NOT NULL COMMENT 'Date the request was sent in Unix time',
6-
`bio` TEXT NOT NULL COMMENT 'Optional. Bio of the user',
6+
`bio` TEXT NULL COMMENT 'Optional. Bio of the user',
77
`invite_link` TEXT NULL COMMENT 'Optional. Chat invite link that was used by the user to send the join request',
88
`created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
99

0 commit comments

Comments
 (0)