Compare commits

..

10 Commits

Author SHA1 Message Date
Toutsu e15652399b feat(bot): register Telegram command menu on startup
Deploy Telegram Bot / build-and-push (push) Successful in 23m54s
Deploy Telegram Bot / scan-images (push) Successful in 9m14s
Deploy Telegram Bot / deploy (push) Successful in 1m41s
Set /start, /newsession, /listsessions, /exportcalendar and /help
via setMyCommands for both private chats and group chats so users
see the command list when typing '/'.

Also update /help text to list all commands first and then show the
example.
2026-06-15 11:41:33 +03:00
Toutsu 40b13db320 fix(list-sessions): clarify manager action button labels
Deploy Telegram Bot / build-and-push (push) Successful in 3m6s
Deploy Telegram Bot / scan-images (push) Successful in 8m43s
Deploy Telegram Bot / deploy (push) Successful in 2m5s
The /listsessions buttons for owners/co-GMs only showed emoji + date,
so it was unclear what each button did. Add explicit verb labels:
-  Отменить <date>
-  Перенести <date>
- ⬆️ С ожидания <date>
- 🗑 Удалить <date>

Update the renderer test to assert the new labels.
2026-06-15 10:57:15 +03:00
Toutsu e0ee8fc962 fix(list-sessions): clarify manager action button labels
The /listsessions buttons for owners/co-GMs only showed emoji + date,
so it was unclear what each button did. Add explicit verb labels:
-  Отменить <date>
-  Перенести <date>
- ⬆️ С ожидания <date>
- 🗑 Удалить <date>

Update the renderer test to assert the new labels.
2026-06-15 10:56:42 +03:00
Toutsu 6707a2850c fix(list-sessions): clarify manager action button labels
Deploy Telegram Bot / build-and-push (push) Successful in 23m5s
Deploy Telegram Bot / scan-images (push) Failing after 13m20s
Deploy Telegram Bot / deploy (push) Has been skipped
The /listsessions buttons for owners/co-GMs only showed emoji + date,
so it was unclear what each button did. Add explicit verb labels:
-  Отменить <date>
-  Перенести <date>
- ⬆️ С ожидания <date>
- 🗑 Удалить <date>

Update the renderer test to assert the new labels.
2026-06-15 10:55:59 +03:00
Toutsu d137c334d6 Merge pull request 'ci(deploy): increase trivy image scan timeout to 30m' (#141) from fix/deploy-trivy-image-timeout into main
Deploy Telegram Bot / build-and-push (push) Successful in 6m5s
Deploy Telegram Bot / scan-images (push) Successful in 9m39s
Deploy Telegram Bot / deploy (push) Successful in 2m9s
Merge pull request #141: ci(deploy): increase trivy image scan timeout to 30m
2026-06-13 20:28:21 +03:00
Toutsu 27f9ceb038 ci(deploy): increase trivy image scan timeout to 30m
PR Checks / test-and-build (pull_request) Successful in 27m45s
Slow ARM64 runners hit the default timeout while initializing the
container image scan after pulling. Extend the timeout so image scans
can complete reliably.
2026-06-13 20:24:23 +03:00
Toutsu f53c1f6aae Merge branch 'main' of ssh://git.codeanddice.ru:222/Toutsu/GmRelayBot 2026-06-13 20:24:07 +03:00
Toutsu e59b0a78fd Merge pull request 'ci(deploy): login and pull images before Trivy scan' (#140) from fix/deploy-scan-pull-images into main
Deploy Telegram Bot / build-and-push (push) Successful in 4m21s
Deploy Telegram Bot / scan-images (push) Successful in 9m18s
Deploy Telegram Bot / deploy (push) Successful in 1m10s
Merge pull request #140: ci(deploy): login and pull images before Trivy scan
2026-06-13 19:32:15 +03:00
Toutsu b952be23eb ci(deploy): login and pull images before Trivy scan
PR Checks / test-and-build (pull_request) Successful in 32m3s
The scan-images job runs on a fresh runner that does not have the images
built by the build-and-push job. Login to the registry and pull the
images before scanning, otherwise Trivy cannot find them.
2026-06-13 19:29:57 +03:00
Toutsu 4054d49ccb Merge pull request 'feat(rendering): display description, system, duration, format, type and location in Telegram game card' (#139) from feature/telegram-game-card-fields into main
Deploy Telegram Bot / build-and-push (push) Successful in 3m51s
Deploy Telegram Bot / scan-images (push) Failing after 8m4s
Deploy Telegram Bot / deploy (push) Has been skipped
Merge pull request #139: feat(rendering): display description, system, duration, format, type and location in Telegram game card

Bump version to 3.11.0.
2026-06-13 18:43:40 +03:00
6 changed files with 80 additions and 6 deletions
+17 -1
View File
@@ -70,6 +70,13 @@ jobs:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.codeanddice.ru
username: toutsu
password: ${{ secrets.GIT_TOKEN }}
- name: Install Trivy
run: |
# Install Trivy from the official Docker image instead of the
@@ -78,7 +85,7 @@ jobs:
# GitHub releases API; when a release is unpublished or
# yanked, the script fails with
# `unable to find '<tag>' - use 'latest' or see ...`
# even when the release once existed. We hit this with
# when the release once existed. We hit this with
# v0.71.0.
# 2. Docker Hub tags are content-addressed and rarely
# removed, so a pinned image tag is much more stable.
@@ -94,9 +101,16 @@ jobs:
chmod +x /usr/local/bin/trivy
trivy --version
- name: Pull images for scan
run: |
docker pull git.codeanddice.ru/toutsu/gmrelay-bot:${{ env.VERSION }}
docker pull git.codeanddice.ru/toutsu/gmrelay-discord-bot:${{ env.VERSION }}
docker pull git.codeanddice.ru/toutsu/gmrelay-web:${{ env.VERSION }}
- name: Scan Bot image
run: |
trivy image \
--timeout 30m \
--severity HIGH,CRITICAL \
--exit-code 1 \
--format table \
@@ -105,6 +119,7 @@ jobs:
- name: Scan Discord Bot image
run: |
trivy image \
--timeout 30m \
--severity HIGH,CRITICAL \
--exit-code 1 \
--format table \
@@ -113,6 +128,7 @@ jobs:
- name: Scan Web image
run: |
trivy image \
--timeout 30m \
--severity HIGH,CRITICAL \
--exit-code 1 \
--format table \
@@ -36,19 +36,19 @@ internal static class SessionListMessageRenderer
actions.Add(new PlatformMessageAction(
$"cancel_session:{session.Id}",
$"❌ {dateTitle}",
$"❌ Отменить {dateTitle}",
$"cancel_session:{session.Id}"));
actions.Add(new PlatformMessageAction(
$"reschedule_session:{session.Id}",
$"⏰ {dateTitle}",
$"⏰ Перенести {dateTitle}",
$"reschedule_session:{session.Id}"));
if (SessionCapacityRules.CanPromoteWaitlistedPlayer(session.MaxPlayers, session.PlayerCount, session.WaitlistCount))
{
actions.Add(new PlatformMessageAction(
$"promote_waitlist:{session.Id}",
$"⬆️ Из ожидания {dateTitle}",
$"⬆️ С ожидания {dateTitle}",
$"promote_waitlist:{session.Id}"));
}
@@ -0,0 +1,46 @@
using Telegram.Bot;
using Telegram.Bot.Types;
namespace GmRelay.Bot.Infrastructure.Telegram;
/// <summary>
/// Registers the bot's command list with Telegram so users see the
/// command menu when they type "/" in a chat.
/// </summary>
public sealed class TelegramCommandsSetupService(
ITelegramBotClient bot,
ILogger<TelegramCommandsSetupService> logger) : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
var commands = new[]
{
new BotCommand { Command = "start", Description = "Начать работу с ботом" },
new BotCommand { Command = "newsession", Description = "Создать новую игровую сессию" },
new BotCommand { Command = "listsessions", Description = "Список предстоящих сессий" },
new BotCommand { Command = "exportcalendar", Description = "Экспортировать расписание в ICS" },
new BotCommand { Command = "help", Description = "Справка по командам" }
};
try
{
await bot.SetMyCommands(
commands,
scope: new BotCommandScopeAllPrivateChats(),
cancellationToken: cancellationToken);
await bot.SetMyCommands(
commands,
scope: new BotCommandScopeAllGroupChats(),
cancellationToken: cancellationToken);
logger.LogInformation("Telegram command menu registered for private chats and groups.");
}
catch (Exception ex)
{
logger.LogWarning(ex, "Failed to register Telegram command menu.");
}
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
@@ -366,6 +366,13 @@ public sealed class UpdateRouter(
text: """
GM-Relay бот для управления игровыми сессиями.
/start начать работу с ботом
/newsession создать новую игровую сессию
/listsessions список предстоящих сессий
/exportcalendar экспортировать расписание в ICS
/help эта справка
Пример создания сессии:
/newsession
Название: My Game
Время: 15.05.2026 19:30
@@ -377,10 +384,8 @@ public sealed class UpdateRouter(
Игр: 4
Интервал: 7
/listsessions список предстоящих сессий
Для owner/co-GM /listsessions показывает кнопки отмены, переноса, удаления и повышения из листа ожидания.
Игроки могут записаться кнопкой «На дату» и сняться кнопкой «Выйти».
/help эта справка
""",
cancellationToken: ct);
break;
+1
View File
@@ -98,6 +98,7 @@ builder.Services.AddSingleton<DirectSessionNotificationSender>();
// ── Telegram infrastructure ──────────────────────────────────────────
builder.Services.AddSingleton<UpdateRouter>();
builder.Services.AddSingleton<ITelegramUpdateHandler>(sp => sp.GetRequiredService<UpdateRouter>());
builder.Services.AddHostedService<TelegramCommandsSetupService>();
builder.Services.AddHostedService<TelegramMiniAppMenuButtonService>();
builder.Services.AddHostedService<TelegramBotService>();
@@ -32,6 +32,12 @@ public sealed class SessionListMessageRendererTests
Assert.Contains(actions, a => a.Payload == $"reschedule_session:{sessionId}");
Assert.Contains(actions, a => a.Payload == $"promote_waitlist:{sessionId}");
Assert.Contains(actions, a => a.Payload == $"delete_session:{sessionId}");
var shortDate = new DateTime(2026, 5, 7, 16, 30, 0, DateTimeKind.Utc).FormatMoscowShort();
Assert.Contains(actions, a => a.Label == $"❌ Отменить {shortDate}");
Assert.Contains(actions, a => a.Label == $"⏰ Перенести {shortDate}");
Assert.Contains(actions, a => a.Label == $"⬆️ С ожидания {shortDate}");
Assert.Contains(actions, a => a.Label == $"🗑 Удалить {shortDate}");
}
[Fact]