| | | 1 | | namespace TeleFlow.Annotations; |
| | | 2 | | /// <summary> |
| | | 3 | | /// Configures automatic answering of matched Telegram callback queries. |
| | | 4 | | /// </summary> |
| | | 5 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] |
| | | 6 | | public sealed class AutoAnswerCallbackAttribute : TeleFlowAttribute |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Enables automatic callback answering with no text. |
| | | 10 | | /// </summary> |
| | 4 | 11 | | public AutoAnswerCallbackAttribute() |
| | | 12 | | { |
| | 4 | 13 | | } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Enables automatic callback answering with the specified answer text. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="text">Text to send in the callback query answer.</param> |
| | 16 | 19 | | public AutoAnswerCallbackAttribute(string text) |
| | | 20 | | { |
| | 16 | 21 | | ArgumentException.ThrowIfNullOrWhiteSpace(text); |
| | 16 | 22 | | Text = text.Trim(); |
| | 16 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Text sent in the automatic callback query answer. |
| | | 27 | | /// </summary> |
| | | 28 | | public string? Text { get; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Shows the callback answer as an alert instead of a notification. |
| | | 32 | | /// </summary> |
| | | 33 | | public bool ShowAlert { get; set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Enables or disables automatic callback answering for the annotated scope. |
| | | 37 | | /// </summary> |
| | | 38 | | public bool Enabled { get; set; } = true; |
| | | 39 | | } |