mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Notification when user is flooding, fixes
This commit is contained in:
@@ -27,7 +27,7 @@ public class MemoryAntiFloodService : IAntiFlood
|
|||||||
var dictKey = DictKey(chat, user);
|
var dictKey = DictKey(chat, user);
|
||||||
if (_bannedUsers.TryGetValue(dictKey, out var expirationTime))
|
if (_bannedUsers.TryGetValue(dictKey, out var expirationTime))
|
||||||
{
|
{
|
||||||
if (DateTime.UtcNow <= expirationTime)
|
if (DateTime.UtcNow > expirationTime)
|
||||||
{
|
{
|
||||||
expirationTime = DateTime.MinValue;
|
expirationTime = DateTime.MinValue;
|
||||||
_bannedUsers.Remove(dictKey);
|
_bannedUsers.Remove(dictKey);
|
||||||
|
|||||||
+2
-12
@@ -30,19 +30,9 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0.1-alpine3.14
|
|||||||
WORKDIR /user
|
WORKDIR /user
|
||||||
COPY --from=build /app /app
|
COPY --from=build /app /app
|
||||||
|
|
||||||
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl \
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
|
||||||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \
|
|
||||||
Logging__Console__FormatterName=Simple
|
Logging__Console__FormatterName=Simple
|
||||||
|
|
||||||
RUN apk add --no-cache cmake make musl-dev gcc gettext-dev libintl icu-libs \
|
RUN apk add --no-cache icu-libs
|
||||||
&& wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
|
|
||||||
&& unzip musl-locales-master.zip \
|
|
||||||
&& cd musl-locales-master \
|
|
||||||
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
|
|
||||||
&& cd .. && rm -r musl-locales-master
|
|
||||||
|
|
||||||
ENV LANG ru_RU.UTF-8
|
|
||||||
ENV LANGUAGE ru_RU.UTF-8
|
|
||||||
ENV LC_ALL ru_RU.UTF-8
|
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "/app/TelegramBot.dll"]
|
ENTRYPOINT ["dotnet", "/app/TelegramBot.dll"]
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ public class Reputation : CommonHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
_antiFlood.RecordAction(Chat, From);
|
_antiFlood.RecordAction(Chat, From);
|
||||||
|
if (_antiFlood.IsUserFlooding(Chat, From))
|
||||||
|
{
|
||||||
|
await Reply(new HtmlString()
|
||||||
|
.UserMention(From).Pre(": пользователь отправлен в игнор.")
|
||||||
|
.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var senderRepCount = await GetUserReputation(From);
|
var senderRepCount = await GetUserReputation(From);
|
||||||
|
|||||||
Reference in New Issue
Block a user