mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Merge pull request #18 from Bubuni-Team/feature/animation-set-message
[entertainment] add animation set message, fix HandleAnimation method visibility
This commit is contained in:
@@ -51,10 +51,11 @@ namespace West.Entertainment.Handler.Fun
|
|||||||
var animationFileOption = await GetAnimationFileOption();
|
var animationFileOption = await GetAnimationFileOption();
|
||||||
animationFileOption.SetValue(animation.FileId);
|
animationFileOption.SetValue(animation.FileId);
|
||||||
_db.AddOrUpdate(animationFileOption);
|
_db.AddOrUpdate(animationFileOption);
|
||||||
|
|
||||||
|
await Bot.SendTextMessageAsync(Chat.Id, "Animation has been set.", replyToMessageId: Message!.ReplyToMessage!.MessageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once MemberCanBeProtected.Global
|
protected virtual async Task<bool> HandleAnimation()
|
||||||
public virtual async Task<bool> HandleAnimation()
|
|
||||||
{
|
{
|
||||||
var text = Message!.Text!.ToLower();
|
var text = Message!.Text!.ToLower();
|
||||||
if (!AnimationMatch.IsMatch(text.ToLower()) || text.StartsWith("/set") || !CanHandle()) return false;
|
if (!AnimationMatch.IsMatch(text.ToLower()) || text.StartsWith("/set") || !CanHandle()) return false;
|
||||||
@@ -100,11 +101,6 @@ namespace West.Entertainment.Handler.Fun
|
|||||||
return await _db.UserValues.FindOrCreateOption(Chat.Id, $"{GetAnimationName()}NextUse");
|
return await _db.UserValues.FindOrCreateOption(Chat.Id, $"{GetAnimationName()}NextUse");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> CanPunish()
|
|
||||||
{
|
|
||||||
return RepliedUser != null && await Bot.CanPunishMember(Chat, From, RepliedUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual int? GetMessageIdToReply() => Message?.MessageId;
|
protected virtual int? GetMessageIdToReply() => Message?.MessageId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user