Compare commits

...

12 commits
5.3.0 ... v5

Author SHA1 Message Date
2a3fe1f45c
Updated release url with the new repo url 2024-12-22 19:52:47 +13:00
6841c3969a
fixed iam with exclusive roles (in some cases?) being broken 2024-12-20 23:44:49 +13:00
5d4e730f35
updated changelog, updated version
.notify commands are no longer owner only, they now require Admin permissions
.notify messages can now mention anyone
2024-12-16 17:47:04 +13:00
29822cd0cb
.banner fixed, will now show guild banner if available, otherwise global banner, if available 2024-12-15 20:34:04 +13:00
75f5cfde29
.dmcmd will now correctly block commands in dms, not globally
timely will no longer require guild context, as dmcmd .timely will do the same thing
updated changelog, updated version
2024-12-13 22:51:14 +13:00
756555a061
bannersize fixed, honeypot will now put 'Honeypot' as a ban reason 2024-12-13 22:35:53 +13:00
e05792639c
.sclr will now correctly show the color without alpha prefixed 2024-12-12 19:43:33 +13:00
4283a939b7
.banner will now show a 'no banner' error, and will use image embed instead of thumbnail to show the banner. Only user server banners will be shown for now, global user banners will still not work. 2024-12-12 19:40:14 +13:00
a7529496ce
winlb now has 9 items per page to look not broken 2024-12-12 19:33:44 +13:00
a943a2a4ec
winlb now has a title 2024-12-12 19:29:53 +13:00
afc1541865
added role icon to .inrole, .winlb will now show userids when user can't be found 2024-12-11 12:35:17 +13:00
4910e53854
winlb embed fields are now inline to use less space 2024-12-11 01:25:16 +13:00
15 changed files with 79 additions and 29 deletions

View file

@ -2,6 +2,35 @@
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.1.0/) except date format. a-c-f-r-o
## [5.3.3] - 16.12.2024
## Fixed
- `.notify` commands are no longer owner only, they now require Admin permissions
- `.notify` messages can now mention anyone
## [5.3.2] - 14.12.2024
## Fixed
- `.banner` should be working properly now with both server and global user banners
## [5.3.1] - 13.12.2024
## Changed
- `.translate` will now use 2 embeds, to allow for longer messages
- Added role icon to `.inrole`, if it exists
- `.honeypot` will now add a 'Honeypot' as a ban reason.
## Fixed
- `.winlb` looks better, has a title, shows 9 entries now
- `.sar ex` help updated
- `.banner` partially fixed, it still can't show global banners, but it will show guild ones correctly, in a good enough size
- `.sclr` will now show correct color hexes without alpha
- `.dmcmd` will now correctly block commands in dms, not globally
## [5.3.0] - 10.12.2024
## Added

View file

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

View file

@ -71,7 +71,7 @@ public sealed class HoneyPotService : IHoneyPotService, IReadyExecutor, IExecNoC
try
{
Log.Information("Honeypot caught user {User} [{UserId}]", user, user.Id);
await user.BanAsync(pruneDays: 1);
await user.BanAsync(pruneDays: 1, reason: "Honeypot");
await user.Guild.RemoveBanAsync(user.Id);
}
catch (Exception e)

View file

@ -8,7 +8,7 @@ public partial class Administration
public class NotifyCommands : EllieModule<NotifyService>
{
[Cmd]
[OwnerOnly]
[UserPerm(GuildPerm.Administrator)]
public async Task Notify()
{
await Response()
@ -42,7 +42,7 @@ public partial class Administration
};
[Cmd]
[OwnerOnly]
[UserPerm(GuildPerm.Administrator)]
public async Task Notify(NotifyType nType, [Leftover] string? message = null)
{
if (string.IsNullOrWhiteSpace(message))
@ -76,7 +76,7 @@ public partial class Administration
}
[Cmd]
[OwnerOnly]
[UserPerm(GuildPerm.Administrator)]
public async Task NotifyList(int page = 1)
{
if (--page < 0)
@ -104,7 +104,7 @@ public partial class Administration
}
[Cmd]
[OwnerOnly]
[UserPerm(GuildPerm.Administrator)]
public async Task NotifyClear(NotifyType nType)
{
await _service.DisableAsync(ctx.Guild.Id, nType);

View file

@ -146,6 +146,7 @@ public sealed class NotifyService : IReadyExecutor, INotifySubscriber, IEService
await _mss.Response(channel)
.Text(st)
.Sanitize(false)
.SendAsync();
}

View file

@ -19,7 +19,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
private readonly IMessageSenderService _sender;
private const string RELEASES_URL = "https://toastielab.dev/api/v1/repos/Emotions-stuff/elliebot/releases";
private const string RELEASES_URL = "https://toastielab.dev/api/v1/repos/EllieBotDevs/elliebot/releases";
public CheckForUpdatesService(
BotConfigService bcs,
@ -72,7 +72,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
UpdateLastKnownVersion(latestVersion);
// pull changelog
var changelog = await http.GetStringAsync("https://toastielab.dev/Emotions-stuff/elliebot/raw/branch/v5/CHANGELOG.md");
var changelog = await http.GetStringAsync("https://toastielab.dev/EllieBotDevs/elliebot/raw/branch/v5/CHANGELOG.md");
var thisVersionChangelog = GetVersionChangelog(latestVersion, changelog);
@ -95,7 +95,7 @@ public sealed class CheckForUpdatesService : IEService, IReadyExecutor
.WithOkColor()
.WithAuthor($"EllieBot v{latest} Released!")
.WithTitle("Changelog")
.WithUrl("https://toastielab.dev/Emotions-stuff/elliebot/src/branch/v5/CHANGELOG.md")
.WithUrl("https://toastielab.dev/EllieBotDevs/elliebot/src/branch/v5/CHANGELOG.md")
.WithDescription(thisVersionChangelog.TrimTo(4096))
.WithFooter(
"You may disable these messages by typing '.conf bot checkforupdates false'");

View file

@ -280,8 +280,12 @@ public sealed class SarAssignerService : IEService, IReadyExecutor
if (item.Group.IsExclusive)
{
var rolesToRemove = item.Group.Roles.Select(x => x.RoleId);
await item.User.RemoveRolesAsync(rolesToRemove);
var rolesToRemove = item.Group.Roles
.Where(x => item.User.RoleIds.Contains(x.RoleId))
.Select(x => x.RoleId)
.ToArray();
if (rolesToRemove.Length > 0)
await item.User.RemoveRolesAsync(rolesToRemove);
}
await item.User.AddRoleAsync(item.RoleId);

View file

@ -149,7 +149,10 @@ public partial class Gambling
?? (await _userService.GetUserAsync(x.UserId))?.Username
?? x.UserId.ToString();
outputItems.Add(new WinLbStat(i + 1 + (page * 10), user, x.Game, x.MaxWin));
if (user.StartsWith("??"))
user = x.UserId.ToString();
outputItems.Add(new WinLbStat(i + 1 + (page * 9), user, x.Game, x.MaxWin));
}
return outputItems;
@ -166,11 +169,12 @@ public partial class Gambling
await Response()
.Paginated()
.PageItems(p => GetCachedWinLbAsync(p))
.PageSize(10)
.PageSize(9)
.Page((items, curPage) =>
{
var eb = CreateEmbed()
.WithOkColor();
.WithTitle(GetText(strs.winlb))
.WithOkColor();
if (items.Count == 0)
{
@ -182,7 +186,8 @@ public partial class Gambling
{
var item = items[i];
eb.AddField($"#{item.Rank} {item.User}",
$"{N(item.MaxWin)}\n`{item.Game.ToString().ToLower()}`");
$"{N(item.MaxWin)}\n`{item.Game.ToString().ToLower()}`",
true);
}
return eb;

View file

@ -135,7 +135,6 @@ public partial class Gambling : GamblingModule<GamblingService>
});
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task Timely()
{
var val = Config.Timely.Amount;

View file

@ -60,8 +60,8 @@ public sealed class UserBetStatsService : IEService
await using var ctx = _db.GetDbContext();
return await ctx.GetTable<UserBetStats>()
.OrderByDescending(x => x.MaxWin)
.Skip(page * 10)
.Take(10)
.Skip(page * 9)
.Take(9)
.ToArrayAsyncLinqToDB();
}
}

View file

@ -92,13 +92,13 @@ public class GlobalPermissionService : IExecPreCommand, IEService
{
if (priv)
{
if (bs.Blocked.Commands.Add(commandName))
if (bs.DmBlocked.Commands.Add(commandName))
{
added = true;
}
else
{
bs.Blocked.Commands.Remove(commandName);
bs.DmBlocked.Commands.Remove(commandName);
added = false;
}

View file

@ -417,15 +417,25 @@ public partial class Searches : EllieModule<SearchesService>
{
usr ??= (IGuildUser)ctx.User;
var bannerUrl = usr.GetGuildBannerUrl();
var bannerUrl = usr.GetGuildBannerUrl(size: 2048)
?? (await ((DiscordSocketClient)ctx.Client).Rest.GetUserAsync(usr.Id))?.GetBannerUrl();
if (bannerUrl is null)
{
await Response()
.Error(strs.no_banner)
.SendAsync();
return;
}
await Response()
.Embed(
CreateEmbed()
.WithOkColor()
.AddField("Username", usr.ToString())
.AddField("Banner Url", bannerUrl)
.WithThumbnailUrl(bannerUrl))
.AddField("Username", usr.ToString(), true)
.AddField("Banner Url", bannerUrl, true)
.WithImageUrl(bannerUrl))
.SendAsync();
}

View file

@ -13,9 +13,9 @@ public partial class Utility
public async Task ServerColorsShow()
{
var colors = _service.GetColors(ctx.Guild.Id);
var okHex = colors?.Ok?.RawValue.ToString("X8");
var warnHex = colors?.Warn?.RawValue.ToString("X8");
var errHex = colors?.Error?.RawValue.ToString("X8");
var okHex = colors?.Ok?.RawValue.ToString("x6");
var warnHex = colors?.Warn?.RawValue.ToString("x6");
var errHex = colors?.Error?.RawValue.ToString("x6");
EmbedBuilder[] ebs =
[
CreateEmbed()

View file

@ -186,7 +186,7 @@ public partial class Utility : EllieModule
return CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.inrole_list(roleName, roleUsers.Count)))
.WithTitle(GetText(strs.inrole_list(role?.GetIconUrl() + roleName, roleUsers.Count)))
.WithDescription(string.Join("\n", pageUsers));
})
.SendAsync();

View file

@ -1157,5 +1157,7 @@
"notify_desc_protection": "Triggers when antialt, antispam or antiraid is triggered.",
"notify_desc_addrolerew": "Triggers when a user gets a role as a reward for reaching a level (xprew).",
"notify_desc_removerolerew": "Triggers when a user loses a role as a reward for reaching a level (xprew).",
"notify_desc_not_found": "No description found for this notify event. Please report this."
"notify_desc_not_found": "No description found for this notify event. Please report this.",
"winlb": "Biggest Wins Leaderboard",
"no_banner": "No banner set."
}