Compare commits

...

2 commits

Author SHA1 Message Date
082cf79736
Fixed localization init
xp card name is now a little lower
Updated CHANGELOG.md
2025-03-14 20:10:47 +13:00
612c230b7b
fixed unban/unmute timers wrongly trying to unban users on all servers at once 2025-03-14 18:04:58 +13:00
8 changed files with 157 additions and 136 deletions

View file

@ -2,7 +2,7 @@
*a,c,f,r,o*
## [6.0.3] - 12.03.2025
## [6.0.4] - 14.03.2025
### Added

View file

@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Version>6.0.3</Version>
<Version>6.0.4</Version>
<!-- Output/build -->
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>

View file

@ -15,7 +15,12 @@ public enum MuteType
public class MuteService : IEService, IReadyExecutor
{
public enum TimerType { Mute, Ban, AddRole }
public enum TimerType
{
Mute,
Ban,
AddRole
}
private static readonly OverwritePermissions _denyOverwrite = new(addReactions: PermValue.Deny,
sendMessages: PermValue.Deny,
@ -121,8 +126,12 @@ public class MuteService : IEService, IReadyExecutor
if (type == MuteType.All)
{
try
{ await usr.ModifyAsync(x => x.Mute = true); }
catch { }
{
await usr.ModifyAsync(x => x.Mute = true);
}
catch
{
}
var muteRole = await GetMuteRole(usr.Guild);
if (!usr.RoleIds.Contains(muteRole.Id))
@ -160,7 +169,9 @@ public class MuteService : IEService, IReadyExecutor
await usr.ModifyAsync(x => x.Mute = true);
UserMuted(usr, mod, MuteType.Voice, reason);
}
catch { }
catch
{
}
}
else if (type == MuteType.Chat)
{
@ -197,11 +208,17 @@ public class MuteService : IEService, IReadyExecutor
if (usr is not null)
{
try
{ await usr.ModifyAsync(x => x.Mute = false); }
catch { }
{
await usr.ModifyAsync(x => x.Mute = false);
}
catch
{
}
try
{ await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild)); }
{
await usr.RemoveRoleAsync(await GetMuteRole(usr.Guild));
}
catch
{
/*ignore*/
@ -240,7 +257,9 @@ public class MuteService : IEService, IReadyExecutor
//if it doesn't exist, create it
{
try
{ muteRole = await guild.CreateRoleAsync(muteRoleName, isMentionable: false); }
{
muteRole = await guild.CreateRoleAsync(muteRoleName, isMentionable: false);
}
catch
{
//if creations fails, maybe the name is not correct, find default one, if doesn't work, create default one
@ -443,8 +462,6 @@ public class MuteService : IEService, IReadyExecutor
.Where(x => Queries.GuildOnShard(x.GuildId, _shardData.TotalShards, _shardData.ShardId))
.ToListAsyncLinqToDB();
foreach (var conf in configs)
{
foreach (var x in unmuteTimers)
{
TimeSpan after;
@ -458,7 +475,7 @@ public class MuteService : IEService, IReadyExecutor
after = unmute > max ? max : unmute;
}
StartUn_Timer(conf.GuildId, x.UserId, after, TimerType.Mute);
StartUn_Timer(x.GuildId, x.UserId, after, TimerType.Mute);
}
foreach (var x in unbanTimers)
@ -474,7 +491,7 @@ public class MuteService : IEService, IReadyExecutor
after = unban > max ? max : unban;
}
StartUn_Timer(conf.GuildId, x.UserId, after, TimerType.Ban);
StartUn_Timer(x.GuildId, x.UserId, after, TimerType.Ban);
}
foreach (var x in unroleTimers)
@ -490,8 +507,7 @@ public class MuteService : IEService, IReadyExecutor
after = unban > max ? max : unban;
}
StartUn_Timer(conf.GuildId, x.UserId, after, TimerType.AddRole, x.RoleId);
}
StartUn_Timer(x.GuildId, x.UserId, after, TimerType.AddRole, x.RoleId);
}
_client.UserJoined += Client_UserJoined;

View file

@ -716,8 +716,13 @@ public partial class Administration
var banPrune = await _service.GetBanPruneAsync(ctx.Guild.Id) ?? 7;
await ctx.Guild.AddBanAsync(user, banPrune, ("Softban | " + ctx.User + " | " + msg).TrimTo(512));
try
{ await ctx.Guild.RemoveBanAsync(user); }
catch { await ctx.Guild.RemoveBanAsync(user); }
{
await ctx.Guild.RemoveBanAsync(user);
}
catch
{
}
var toSend = CreateEmbed()
.WithOkColor()

View file

@ -119,7 +119,7 @@ public class XpTemplate
Pos = new()
{
X = 394,
Y = 35
Y = 40
},
Show = true
}

View file

@ -12,7 +12,7 @@ public class Localization : ILocalization, IReadyExecutor, IEService
JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
File.ReadAllText("./strings/commands/commands.en-US.json"));
private ConcurrentDictionary<ulong, CultureInfo> _guildCultureInfos;
private ConcurrentDictionary<ulong, CultureInfo> _guildCultureInfos = [];
public IDictionary<ulong, CultureInfo> GuildCultureInfos
=> _guildCultureInfos;

View file

@ -21,7 +21,7 @@ dice:
- https://cdn.nadeko.bot/other/dice/8.png
- https://cdn.nadeko.bot/other/dice/9.png
xp:
bg: https://cdn.nadeko.bot/xp/bgs/v6.png
bg: https://cdn.nadeko.bot/other/xp/bg6_mini.png
slots:
emojis:
- https://cdn.nadeko.bot/slots/10.png

View file

@ -8,21 +8,21 @@
"Name": {
"Color": "ffffffff",
"Show": true,
"FontSize": 50,
"FontSize": 25,
"Pos": {
"X": 105,
"Y": 25
"X": 65,
"Y": 8
}
},
"Icon": {
"Show": true,
"Pos": {
"X": 14,
"Y": 14
"X": 11,
"Y": 11
},
"Size": {
"X": 72,
"Y": 71
"X": 38,
"Y": 38
}
},
"Level": {
@ -47,26 +47,26 @@
"Bar": {
"Show": true,
"Guild": {
"Color": "00000095",
"Color": "00000066",
"PointA": {
"X": 282,
"Y": 248
"X": 202,
"Y": 66
},
"PointB": {
"X": 247,
"Y": 379
"X": 180,
"Y": 145
},
"Length": 450,
"Length": 225,
"Direction": 3
}
},
"Guild": {
"Color": "ffffffff",
"Show": true,
"FontSize": 50,
"FontSize": 25,
"Pos": {
"X": 490,
"Y": 313
"X": 330,
"Y": 104
}
}
}
@ -75,21 +75,21 @@
"Icon": {
"Show": true,
"Pos": {
"X": 722,
"Y": 25
"X": 451,
"Y": 15
},
"Size": {
"X": 45,
"Y": 45
"X": 29,
"Y": 29
}
},
"Name": {
"Color": "ffffffff",
"Show": true,
"FontSize": 35,
"FontSize": 20,
"Pos": {
"X": 650,
"Y": 55
"X": 394,
"Y": 40
}
}
}