DotNetNomads / UltraMafia

The first OpenSource Mafia Bot!
MIT License
9 stars 5 forks source link

Fix pin issue on non super groups #6

Closed binali-rustamov closed 4 years ago

binali-rustamov commented 4 years ago

Make message pin as optional feature. Because of following error:

elegram.Bot.Exceptions.ApiRequestException: Bad Request: not enough rights to pin a message
   at Telegram.Bot.TelegramBotClient.MakeRequestAsync[TResponse](IRequest`1 request, CancellationToken cancellationToken)
   at UltraMafia.Frontend.Telegram.TelegramFrontendExtensions.CreateOrUpdateRegistrationMessage(ITelegramBotClient bot, GameSession session, TelegramFrontendSettings settings) in /tmp/src/UltraMafia/Frontend/Telegram/TelegramFrontendExtensions.cs:line 143
   at UltraMafia.Frontend.Telegram.TelegramFrontend.<>c__DisplayClass33_0.<<OnGamerJoined>b__0>d.MoveNext() in /tmp/src/UltraMafia/Frontend/Telegram/TelegramFrontend.cs:line 562
--- End of stack trace from previous location where exception was thrown ---
   at UltraMafia.Frontend.Telegram.TelegramFrontendExtensions.LockAndDo(ITelegramBotClient bot, Func`1 action) in /tmp/src/UltraMafia/Frontend/Telegram/TelegramFrontendExtensions.cs:line 171
binali-rustamov commented 4 years ago

This issue fixed in 1.0.1, now bot will check access to pin messages before pinning it.