mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
30 lines
896 B
C#
30 lines
896 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using BotFramework;
|
|
using BotFramework.Attributes;
|
|
using BotFramework.Setup;
|
|
using Kruzya.TelegramBot.Core.Cache;
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
using Kruzya.TelegramBot.Core.Extensions;
|
|
using Telegram.Bot.Types.Enums;
|
|
|
|
namespace Kruzya.TelegramBot.UrlLimitations
|
|
{
|
|
public class UserJoinHandler : BotEventHandler
|
|
{
|
|
protected readonly CoreContext dbCtx;
|
|
|
|
public UserJoinHandler(CoreContext coreContext)
|
|
{
|
|
dbCtx = coreContext;
|
|
}
|
|
|
|
[Message(MessageType.ChatMembersAdded, InChat.Public)]
|
|
public async Task OnChatMembersAdded()
|
|
{
|
|
foreach (var member in RawUpdate.Message.NewChatMembers)
|
|
await dbCtx.UserValues.SetOptionValue<UInt16>(Chat.Id, member.Id, "urlLimitations.messagesAfterJoin",
|
|
0);
|
|
}
|
|
}
|
|
} |