mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Merge branch 'v4' of https://gitlab.com/Kwoth/nadekobot into v4
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -2,7 +2,15 @@
|
|||||||
|
|
||||||
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||||
|
|
||||||
## [4.3.12] - 11.02.2023
|
## [4.3.13] - 20.02.2023
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed `.log userpresence`
|
||||||
|
- `.q` will now use `yt-dlp` if anything other than `ytProvider: Ytdl` is set in `data/searches.yml`
|
||||||
|
- Fixed Title links on some embeds
|
||||||
|
|
||||||
|
## [4.3.12] - 12.02.2023
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ It is recommended that you use **Ubuntu 20.04**, as there have been nearly no pr
|
|||||||
|
|
||||||
##### Compatible operating systems:
|
##### Compatible operating systems:
|
||||||
|
|
||||||
- Ubuntu: 16.04, 18.04, 20.04, 21.04, 21.10
|
- Ubuntu: 16.04, 18.04, 20.04
|
||||||
- Mint: 19, 20
|
- Mint: 19, 20
|
||||||
- Debian: 10, 11
|
- Debian: 10, 11
|
||||||
- CentOS: 7
|
- CentOS: 7
|
||||||
|
@@ -9,9 +9,9 @@ using NadekoBot.Services.Database.Models;
|
|||||||
namespace NadekoBot.Modules.Administration;
|
namespace NadekoBot.Modules.Administration;
|
||||||
|
|
||||||
public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||||
#if !GLOBAL_NADEKO
|
#if !GLOBAL_NADEKO
|
||||||
, INService // don't load this service on global nadeko
|
, INService // don't load this service on global nadeko
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public ConcurrentDictionary<ulong, LogSetting> GuildLogSettings { get; }
|
public ConcurrentDictionary<ulong, LogSetting> GuildLogSettings { get; }
|
||||||
|
|
||||||
@@ -73,6 +73,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
_client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated;
|
_client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated;
|
||||||
_client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated_TTS;
|
_client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated_TTS;
|
||||||
_client.GuildMemberUpdated += _client_GuildUserUpdated;
|
_client.GuildMemberUpdated += _client_GuildUserUpdated;
|
||||||
|
_client.PresenceUpdated += _client_PresenceUpdated;
|
||||||
_client.UserUpdated += _client_UserUpdated;
|
_client.UserUpdated += _client_UserUpdated;
|
||||||
_client.ChannelCreated += _client_ChannelCreated;
|
_client.ChannelCreated += _client_ChannelCreated;
|
||||||
_client.ChannelDestroyed += _client_ChannelDestroyed;
|
_client.ChannelDestroyed += _client_ChannelDestroyed;
|
||||||
@@ -90,6 +91,59 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
_punishService.OnUserWarned += PunishServiceOnOnUserWarned;
|
_punishService.OnUserWarned += PunishServiceOnOnUserWarned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task _client_PresenceUpdated(SocketUser user, SocketPresence? before, SocketPresence? after)
|
||||||
|
{
|
||||||
|
if (user is not SocketGuildUser gu)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!GuildLogSettings.TryGetValue(gu.Guild.Id, out var logSetting)
|
||||||
|
|| before is null
|
||||||
|
|| after is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ITextChannel? logChannel;
|
||||||
|
|
||||||
|
if (!user.IsBot
|
||||||
|
&& logSetting.LogUserPresenceId is not null
|
||||||
|
&& (logChannel =
|
||||||
|
await TryGetLogChannel(gu.Guild, logSetting, LogType.UserPresence)) is not null)
|
||||||
|
{
|
||||||
|
if (before.Status != after.Status)
|
||||||
|
{
|
||||||
|
var str = "🎭"
|
||||||
|
+ Format.Code(PrettyCurrentTime(gu.Guild))
|
||||||
|
+ GetText(logChannel.Guild,
|
||||||
|
strs.user_status_change("👤" + Format.Bold(gu.Username),
|
||||||
|
Format.Bold(after.Status.ToString())));
|
||||||
|
PresenceUpdates.AddOrUpdate(logChannel,
|
||||||
|
new List<string>
|
||||||
|
{
|
||||||
|
str
|
||||||
|
},
|
||||||
|
(_, list) =>
|
||||||
|
{
|
||||||
|
list.Add(str);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (before.Activities.FirstOrDefault()?.Name != after.Activities.FirstOrDefault()?.Name)
|
||||||
|
{
|
||||||
|
var str =
|
||||||
|
$"👾`{PrettyCurrentTime(gu.Guild)}`👤__**{gu.Username}**__ is now playing **{after.Activities.FirstOrDefault()?.Name ?? "-"}**.";
|
||||||
|
PresenceUpdates.AddOrUpdate(logChannel,
|
||||||
|
new List<string>
|
||||||
|
{
|
||||||
|
str
|
||||||
|
},
|
||||||
|
(_, list) =>
|
||||||
|
{
|
||||||
|
list.Add(str);
|
||||||
|
return list;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Task _client_ThreadDeleted(Cacheable<SocketThreadChannel, ulong> sch)
|
private Task _client_ThreadDeleted(Cacheable<SocketThreadChannel, ulong> sch)
|
||||||
{
|
{
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
@@ -192,7 +246,9 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
})
|
})
|
||||||
.WhenAll();
|
.WhenAll();
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,13 +311,13 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
logSetting.UserLeftId = logSetting.UserBannedId = logSetting.UserUnbannedId = logSetting.UserUpdatedId =
|
logSetting.UserLeftId = logSetting.UserBannedId = logSetting.UserUnbannedId = logSetting.UserUpdatedId =
|
||||||
logSetting.ChannelCreatedId = logSetting.ChannelDestroyedId = logSetting.ChannelUpdatedId =
|
logSetting.ChannelCreatedId = logSetting.ChannelDestroyedId = logSetting.ChannelUpdatedId =
|
||||||
logSetting.LogUserPresenceId = logSetting.LogVoicePresenceId = logSetting.UserMutedId =
|
logSetting.LogUserPresenceId = logSetting.LogVoicePresenceId = logSetting.UserMutedId =
|
||||||
logSetting.LogVoicePresenceTTSId = value ? channelId : null;
|
logSetting.LogVoicePresenceTTSId = logSetting.ThreadCreatedId = logSetting.ThreadDeletedId
|
||||||
|
= logSetting.LogWarnsId = value ? channelId : null;
|
||||||
await uow.SaveChangesAsync();
|
await uow.SaveChangesAsync();
|
||||||
GuildLogSettings.AddOrUpdate(guildId, _ => logSetting, (_, _) => logSetting);
|
GuildLogSettings.AddOrUpdate(guildId, _ => logSetting, (_, _) => logSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task PunishServiceOnOnUserWarned(Warning arg)
|
private async Task PunishServiceOnOnUserWarned(Warning arg)
|
||||||
{
|
{
|
||||||
if (!GuildLogSettings.TryGetValue(arg.GuildId, out var logSetting) || logSetting.LogWarnsId is null)
|
if (!GuildLogSettings.TryGetValue(arg.GuildId, out var logSetting) || logSetting.LogWarnsId is null)
|
||||||
@@ -676,46 +732,6 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!before.IsBot
|
|
||||||
&& logSetting.LogUserPresenceId is not null
|
|
||||||
&& (logChannel =
|
|
||||||
await TryGetLogChannel(before.Guild, logSetting, LogType.UserPresence)) is not null)
|
|
||||||
{
|
|
||||||
if (before.Status != after.Status)
|
|
||||||
{
|
|
||||||
var str = "🎭"
|
|
||||||
+ Format.Code(PrettyCurrentTime(after.Guild))
|
|
||||||
+ GetText(logChannel.Guild,
|
|
||||||
strs.user_status_change("👤" + Format.Bold(after.Username),
|
|
||||||
Format.Bold(after.Status.ToString())));
|
|
||||||
PresenceUpdates.AddOrUpdate(logChannel,
|
|
||||||
new List<string>
|
|
||||||
{
|
|
||||||
str
|
|
||||||
},
|
|
||||||
(_, list) =>
|
|
||||||
{
|
|
||||||
list.Add(str);
|
|
||||||
return list;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (before.Activities.FirstOrDefault()?.Name != after.Activities.FirstOrDefault()?.Name)
|
|
||||||
{
|
|
||||||
var str =
|
|
||||||
$"👾`{PrettyCurrentTime(after.Guild)}`👤__**{after.Username}**__ is now playing **{after.Activities.FirstOrDefault()?.Name ?? "-"}**.";
|
|
||||||
PresenceUpdates.AddOrUpdate(logChannel,
|
|
||||||
new List<string>
|
|
||||||
{
|
|
||||||
str
|
|
||||||
},
|
|
||||||
(_, list) =>
|
|
||||||
{
|
|
||||||
list.Add(str);
|
|
||||||
return list;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -1060,7 +1076,6 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var embed = _eb.Create()
|
var embed = _eb.Create()
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using NadekoBot.Modules.Searches;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Music;
|
namespace NadekoBot.Modules.Music;
|
||||||
|
|
||||||
@@ -27,11 +28,12 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
|
|||||||
|
|
||||||
private readonly IGoogleApiService _google;
|
private readonly IGoogleApiService _google;
|
||||||
|
|
||||||
public YtdlYoutubeResolver(ITrackCacher trackCacher, IGoogleApiService google)
|
public YtdlYoutubeResolver(ITrackCacher trackCacher, IGoogleApiService google, SearchesConfigService scs)
|
||||||
{
|
{
|
||||||
_trackCacher = trackCacher;
|
_trackCacher = trackCacher;
|
||||||
_google = google;
|
_google = google;
|
||||||
|
|
||||||
|
|
||||||
_ytdlPlaylistOperation = new("-4 "
|
_ytdlPlaylistOperation = new("-4 "
|
||||||
+ "--geo-bypass "
|
+ "--geo-bypass "
|
||||||
+ "--encoding UTF8 "
|
+ "--encoding UTF8 "
|
||||||
@@ -44,7 +46,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
|
|||||||
+ "--no-check-certificate "
|
+ "--no-check-certificate "
|
||||||
+ "-i "
|
+ "-i "
|
||||||
+ "--yes-playlist "
|
+ "--yes-playlist "
|
||||||
+ "-- \"{0}\"");
|
+ "-- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
|
||||||
|
|
||||||
_ytdlIdOperation = new("-4 "
|
_ytdlIdOperation = new("-4 "
|
||||||
+ "--geo-bypass "
|
+ "--geo-bypass "
|
||||||
@@ -56,7 +58,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
|
|||||||
+ "--get-thumbnail "
|
+ "--get-thumbnail "
|
||||||
+ "--get-duration "
|
+ "--get-duration "
|
||||||
+ "--no-check-certificate "
|
+ "--no-check-certificate "
|
||||||
+ "-- \"{0}\"");
|
+ "-- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
|
||||||
|
|
||||||
_ytdlSearchOperation = new("-4 "
|
_ytdlSearchOperation = new("-4 "
|
||||||
+ "--geo-bypass "
|
+ "--geo-bypass "
|
||||||
@@ -69,7 +71,7 @@ public sealed class YtdlYoutubeResolver : IYoutubeResolver
|
|||||||
+ "--get-duration "
|
+ "--get-duration "
|
||||||
+ "--no-check-certificate "
|
+ "--no-check-certificate "
|
||||||
+ "--default-search "
|
+ "--default-search "
|
||||||
+ "\"ytsearch:\" -- \"{0}\"");
|
+ "\"ytsearch:\" -- \"{0}\"", scs.Data.YtProvider != YoutubeSearcher.Ytdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private YtTrackData ResolveYtdlData(string ytdlOutputString)
|
private YtTrackData ResolveYtdlData(string ytdlOutputString)
|
||||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
|
|||||||
|
|
||||||
public sealed class StatsService : IStatsService, IReadyExecutor, INService
|
public sealed class StatsService : IStatsService, IReadyExecutor, INService
|
||||||
{
|
{
|
||||||
public const string BOT_VERSION = "4.3.12";
|
public const string BOT_VERSION = "4.3.13";
|
||||||
|
|
||||||
public string Author
|
public string Author
|
||||||
=> "Kwoth#2452";
|
=> "Kwoth#2452";
|
||||||
|
Reference in New Issue
Block a user