diff --git a/Telegrator.Analyzers/AnalyzerReleases.Unshipped.md b/Telegrator.Analyzers/AnalyzerReleases.Unshipped.md index dcb316e..addebe4 100644 --- a/Telegrator.Analyzers/AnalyzerReleases.Unshipped.md +++ b/Telegrator.Analyzers/AnalyzerReleases.Unshipped.md @@ -11,5 +11,4 @@ TG_1003 | Modelling | Error | GeneratedKeyboardMarkupGenerator TG_1004 | Modelling | Error | GeneratedKeyboardMarkupGenerator TG_1005 | Modelling | Error | GeneratedKeyboardMarkupGenerator TG_1006 | Modelling | Error | GeneratedKeyboardMarkupGenerator -TG_1007 | Modelling | Error | GeneratedKeyboardMarkupGenerator -TR0001 | Aspect | Error | DiagnosticsHelper \ No newline at end of file +TG_1007 | Modelling | Error | GeneratedKeyboardMarkupGenerator \ No newline at end of file diff --git a/Telegrator/Markups/KeyboardMarkupButtonAttributes.cs b/Telegrator/Markups/KeyboardMarkupButtonAttributes.cs index 152f0f9..d097b22 100644 --- a/Telegrator/Markups/KeyboardMarkupButtonAttributes.cs +++ b/Telegrator/Markups/KeyboardMarkupButtonAttributes.cs @@ -1,4 +1,5 @@ -using Telegram.Bot.Types; +using Telegram.Bot; +using Telegram.Bot.Types; using Telegram.Bot.Types.ReplyMarkups; namespace Telegrator.Markups @@ -13,24 +14,19 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Data that will be send to bot + /// Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes /// public string Data { get; } = data; } /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public sealed class GameButtonAttribute(string name, string data) : Attribute + public sealed class GameButtonAttribute(string name) : Attribute { /// /// Name of button /// public string Name { get; } = name; - - /// - /// Game to open - /// - public string Game { get; } = data; } /// @@ -43,7 +39,7 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Text to copy + /// Description of the button that copies the specified text to the clipboard. /// public CopyTextButton CopyText { get; } = copyText; } @@ -68,7 +64,7 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Url of app to login to + /// An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. /// public LoginUrl Url { get; } = url; } @@ -83,7 +79,7 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Url to redirect user + /// HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<UserId> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. /// public string Url { get; } = url; } @@ -98,7 +94,7 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Info about mini app to open + /// Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method AnswerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account. /// public WebAppInfo AppInfo { get; } = webApp; } @@ -111,9 +107,9 @@ namespace Telegrator.Markups /// Name of button /// public string Name { get; } = name; - + /// - /// Query + /// If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account. /// public string Query { get; } = switchInlineQuery; } @@ -128,48 +124,83 @@ namespace Telegrator.Markups public string Name { get; } = name; /// - /// Query + /// If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.

This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a Telegram Business account. ///
public string Query { get; } = switchInlineQueryCurrentChat; } + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class RequestChatButtonAttribute(string name, int requestId, bool chatIsChannel) : Attribute + public class RequestChatButtonAttribute(string name, bool chatIsChannel = true) : Attribute { + /// + /// Name of button + /// public string Name { get; } = name; - public int RequestId { get; } = requestId; + /// + /// Signed 32-bit identifier of the request that will be received back in the object. Must be unique within the message + /// + public int RequestId { get; } = new Random().Next(); + /// + /// Pass to request a channel chat, pass to request a group or a supergroup chat. + /// public bool ChatIsChannel { get; } = chatIsChannel; } + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class RequestContactButtonAttribute(string name) : Attribute { + /// + /// Name of button + /// public string Name { get; } = name; } + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class RequestLocationButtonAttribute(string name) : Attribute { + /// + /// Name of button + /// public string Name { get; } = name; } + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class RequestPoolButtonAttribute(string name, KeyboardButtonPollType requestPoll) : Attribute { + /// + /// Name of button + /// public string Name { get; } = name; + /// + /// If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. + /// public KeyboardButtonPollType PollType { get; } = requestPoll; } + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class RequestUsersButtonAttribute(string name, int requestId, int? maxQuantity = null) : Attribute + public class RequestUsersButtonAttribute(string name, int? maxQuantity = null) : Attribute { + /// + /// Name of button + /// public string Name { get; } = name; - public int RequestId { get; } = requestId; + /// + /// Signed 32-bit identifier of the request that will be received back in the object. Must be unique within the message + /// + public int RequestId { get; } = new Random().Next(); + /// + /// Optional. The maximum number of users to be selected; 1-10. Defaults to 1. + /// public int? MaxQuantity { get; } = maxQuantity; } }