-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
654 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/Telegram.BotAPI/Available Methods/Args/SetChatPermissionsArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2023 Quetzal Rivera. | ||
// Licensed under the MIT License, See LICENCE in the project root for license information. | ||
|
||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Telegram.BotAPI.AvailableTypes | ||
{ | ||
/// <summary> | ||
/// SetChatPermissions method arguments. | ||
/// </summary> | ||
[JsonObject(MemberSerialization = MemberSerialization.OptIn, NamingStrategyType = typeof(SnakeCaseNamingStrategy))] | ||
public class SetChatPermissionsArgs | ||
{ | ||
/// <summary> | ||
/// Initialize a new instance of <see cref="SetChatPermissionsArgs"/>. | ||
/// </summary> | ||
/// <param name="chatId">Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername).</param> | ||
/// <param name="permissions">New default chat permissions.</param> | ||
public SetChatPermissionsArgs(string chatId, ChatPermissions permissions) | ||
{ | ||
this.ChatId = chatId ?? throw new ArgumentNullException(nameof(chatId)); | ||
this.Permissions = permissions ?? throw new ArgumentNullException(nameof(permissions)); | ||
} | ||
|
||
/// <summary> | ||
/// Initialize a new instance of <see cref="SetChatPermissionsArgs"/>. | ||
/// </summary> | ||
/// <param name="chatId">Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername).</param> | ||
/// <param name="permissions">New default chat permissions.</param> | ||
public SetChatPermissionsArgs(long chatId, ChatPermissions permissions) | ||
{ | ||
this.ChatId = chatId; | ||
this.Permissions = permissions ?? throw new ArgumentNullException(nameof(permissions)); | ||
} | ||
|
||
/// <summary> | ||
/// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) | ||
/// </summary> | ||
[JsonPropertyName(PropertyNames.ChatId)] | ||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public object ChatId { get; } | ||
/// <summary> | ||
/// A JSON-serialized object for new default chat permissions | ||
/// </summary> | ||
[JsonPropertyName(PropertyNames.Permissions)] | ||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public ChatPermissions Permissions { get; } | ||
/// <summary> | ||
/// Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. | ||
/// </summary> | ||
[JsonPropertyName(PropertyNames.UseIndependentChatPermissions)] | ||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] | ||
public bool? UseIndependentChatPermissions { get; set; } | ||
|
||
} | ||
} |
Oops, something went wrong.