mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
🚧 Anti-spam system based on entities
This commit is contained in:
+2
-2
@@ -161,11 +161,11 @@ namespace Kruzya.TelegramBot.Core
|
||||
private void HookAppDomain()
|
||||
{
|
||||
var appDomain = AppDomain.CurrentDomain;
|
||||
|
||||
|
||||
appDomain.AssemblyResolve += delegate(object? sender, ResolveEventArgs args)
|
||||
{
|
||||
var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string assemblyPath = Path.Combine(basePath, new AssemblyName(args.Name).Name + ".dll");
|
||||
var assemblyPath = Path.Combine(basePath, new AssemblyName(args.Name).Name + ".dll");
|
||||
if (!File.Exists(assemblyPath))
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Kruzya.TelegramBot.Core.Cache;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
@@ -7,5 +8,8 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
public static IServiceCollection AddQueue<T>(this IServiceCollection collection)
|
||||
=> collection.AddSingleton<ConcurrentQueue<T>>();
|
||||
|
||||
public static IServiceCollection AddMemoryCache<TKey, TValue>(this IServiceCollection collection)
|
||||
=> collection.AddSingleton<MemoryCache<TKey, TValue>>();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
public static string ToHtml(this User user)
|
||||
{
|
||||
var text = new StringBuilder();
|
||||
text.Append("<a href=\"tg://user?id={member.Id}\">");
|
||||
text.Append($"<a href=\"tg://user?id={user.Id}\">");
|
||||
if (!string.IsNullOrWhiteSpace(user.Username))
|
||||
text.Append(user.Username);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user