Код: Выделить всё
public async Task Advance(SocketInteractionContext context, string gameId)
{
await context.Interaction.DeferAsync();
var tracker = await TrackerUtils.TryGetTrackerAsync(_db, context, gameId);
if (tracker == null)
{
await context.Interaction.FollowupAsync("❌ No active tracker found.", ephemeral: true);
return;
}
var result = TurnProcessor.Advance(tracker);
await _db.SaveChangesAsync();
if (result == null)
{
await context.Interaction.FollowupAsync("⚠️ No valid combatant found.", ephemeral: true);
return;
}
SocketGuildUser? user = null;
if (result.MentionUserId.HasValue)
{
user = context.Guild.GetUser(result.MentionUserId.Value);
}
string userMention = user?.Mention ?? $"";
await context.Interaction.FollowupAsync(
result.Message.Replace($"", userMention),
allowedMentions: new AllowedMentions
{
UserIds = result.MentionUserId.HasValue ? new List { result.MentionUserId.Value } : new List()
}
);
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... sh-command
Мобильная версия