mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
voice chats functionality included
This commit is contained in:
parent
61b720c61f
commit
7639b15dc6
@ -31,7 +31,9 @@ data class PromoteChatMember(
|
||||
@SerialName(canPinMessagesField)
|
||||
private val canPinMessages: Boolean? = null,
|
||||
@SerialName(canPromoteMembersField)
|
||||
private val canPromoteMembers: Boolean? = null
|
||||
private val canPromoteMembers: Boolean? = null,
|
||||
@SerialName(canManageVoiceChatsField)
|
||||
private val canManageVoiceChats: Boolean? = null
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "promoteChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@ -26,6 +26,8 @@ data class AdministratorChatMemberImpl(
|
||||
override val canPinMessages: Boolean = false,
|
||||
@SerialName(canPromoteMembersField)
|
||||
override val canPromoteMembers: Boolean = false,
|
||||
@SerialName(canManageVoiceChatsField)
|
||||
override val canManageVoiceChats: Boolean = false,
|
||||
@SerialName(isAnonymousField)
|
||||
override val isAnonymous: Boolean = false,
|
||||
@SerialName(customTitleField)
|
||||
|
@ -30,6 +30,8 @@ data class CreatorChatMember(
|
||||
override val canPinMessages: Boolean = true
|
||||
@Transient
|
||||
override val canPromoteMembers: Boolean = true
|
||||
@Transient
|
||||
override val canManageVoiceChats: Boolean = true
|
||||
@SerialName(statusField)
|
||||
@Required
|
||||
private val type: String = "creator"
|
||||
|
@ -13,6 +13,7 @@ interface AdministratorChatMember : SpecialRightsChatMember {
|
||||
val canRemoveMessages: Boolean
|
||||
val canRestrictMembers: Boolean
|
||||
val canPromoteMembers: Boolean
|
||||
val canManageVoiceChats: Boolean
|
||||
val isAnonymous: Boolean
|
||||
val customTitle: String?
|
||||
}
|
||||
|
@ -239,6 +239,7 @@ const val canInviteUsersField = "can_invite_users"
|
||||
const val canRestrictMembersField = "can_restrict_members"
|
||||
const val canPinMessagesField = "can_pin_messages"
|
||||
const val canPromoteMembersField = "can_promote_members"
|
||||
const val canManageVoiceChatsField = "can_manage_voice_chats"
|
||||
const val pngStickerField = "png_sticker"
|
||||
const val tgsStickerField = "tgs_sticker"
|
||||
|
||||
@ -331,6 +332,7 @@ const val telegramPaymentChargeIdField = "telegram_payment_charge_id"
|
||||
const val providerPaymentChargeIdField = "provider_payment_charge_id"
|
||||
const val providerTokenField = "provider_token"
|
||||
const val providerDataField = "provider_data"
|
||||
const val usersField = "users"
|
||||
|
||||
const val requireNameField = "need_name"
|
||||
const val requirePhoneNumberField = "need_phone_number"
|
||||
|
@ -0,0 +1,3 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
|
||||
|
||||
interface VoiceChatEvent : SupergroupEvent
|
@ -0,0 +1,18 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
|
||||
|
||||
import com.soywiz.klock.TimeSpan
|
||||
import com.soywiz.klock.seconds
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import dev.inmo.tgbotapi.types.durationField
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class VoiceChatEnded(
|
||||
@SerialName(durationField)
|
||||
val duration: Seconds
|
||||
) : VoiceChatEvent {
|
||||
val timeSpan: TimeSpan
|
||||
get() = TimeSpan(duration.seconds.milliseconds)
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
|
||||
|
||||
import dev.inmo.tgbotapi.types.User
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
|
||||
import dev.inmo.tgbotapi.types.usersField
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
class VoiceChatParticipantsInvited(
|
||||
@SerialName(usersField)
|
||||
val users: List<User> = emptyList()
|
||||
) : VoiceChatEvent
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
|
||||
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VoiceChatEvent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
object VoiceChatStarted : VoiceChatEvent
|
@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.games.RawGame
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.UnknownMessageType
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
@ -81,6 +82,11 @@ internal data class RawMessage(
|
||||
private val dice: Dice? = null,
|
||||
private val successful_payment: SuccessfulPayment? = null,
|
||||
|
||||
// Voice Chat Service Messages
|
||||
private val voice_chat_started: VoiceChatStarted? = null,
|
||||
private val voice_chat_ended: VoiceChatEnded? = null,
|
||||
private val voice_chat_participants_invited: VoiceChatParticipantsInvited? = null,
|
||||
|
||||
// login property
|
||||
private val connected_website: String? = null,
|
||||
|
||||
@ -172,6 +178,9 @@ internal data class RawMessage(
|
||||
left_chat_member != null -> LeftChatMember(left_chat_member)
|
||||
new_chat_title != null -> NewChatTitle(new_chat_title)
|
||||
new_chat_photo != null -> NewChatPhoto(new_chat_photo.toList())
|
||||
voice_chat_started != null -> voice_chat_started
|
||||
voice_chat_ended != null -> voice_chat_ended
|
||||
voice_chat_participants_invited != null -> voice_chat_participants_invited
|
||||
delete_chat_photo -> DeleteChatPhoto()
|
||||
group_chat_created -> GroupChatCreated(
|
||||
migrate_to_chat_id
|
||||
|
@ -17,7 +17,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVoiceChats: Boolean? = null
|
||||
) = execute(
|
||||
PromoteChatMember(
|
||||
chatId,
|
||||
@ -31,7 +32,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
canPromoteMembers,
|
||||
canManageVoiceChats
|
||||
)
|
||||
)
|
||||
|
||||
@ -47,7 +49,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVoiceChats: Boolean?
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
userId,
|
||||
@ -60,7 +63,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
canPromoteMembers,
|
||||
canManageVoiceChats
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
@ -75,7 +79,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVoiceChats: Boolean?
|
||||
) = promoteChatMember(
|
||||
chatId,
|
||||
user.id,
|
||||
@ -88,7 +93,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
canPromoteMembers,
|
||||
canManageVoiceChats
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.promoteChatMember(
|
||||
@ -103,7 +109,8 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
canPromoteMembers: Boolean? = null,
|
||||
canManageVoiceChats: Boolean?
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
user.id,
|
||||
@ -116,5 +123,6 @@ suspend fun TelegramBot.promoteChatMember(
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
canPromoteMembers,
|
||||
canManageVoiceChats
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user