Compare commits

..

4 commits
5.3.9 ... v5

5 changed files with 44 additions and 7 deletions
.gitignoreLICENSE
src/EllieBot
Modules
Administration
Games/ChatterBot/_common
data/strings/commands

8
.gitignore vendored
View file

@ -20,6 +20,7 @@ src/EllieBot/credentials.json
src/EllieBot/old_credentials.json
src/EllieBot/credentials.json.bak
src/EllieBot/data/EllieBot.db
# scripts
ellie-menu.ps1
package.sh
@ -371,4 +372,9 @@ __pycache__/
### VisualStudio Patch ###
build/
site/
site/
## AI
.aider.*
PROMPT.md

View file

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2024 Toastie_t0ast
Copyright 2025 Toastie_t0ast
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -97,9 +97,9 @@ public partial class Administration : EllieModule<AdministrationService>
var (enabled, channels) = _service.GetDelMsgOnCmdData(ctx.Guild.Id);
var embed = CreateEmbed()
.WithOkColor()
.WithTitle(GetText(strs.server_delmsgoncmd))
.WithDescription(enabled ? "✅" : "❌");
.WithOkColor()
.WithTitle(GetText(strs.server_delmsgoncmd))
.WithDescription(enabled ? "✅" : "❌");
var str = string.Join("\n",
channels.Select(x =>
@ -301,6 +301,16 @@ public partial class Administration : EllieModule<AdministrationService>
public Task Delete(ulong messageId, ParsedTimespan timespan = null)
=> Delete((ITextChannel)ctx.Channel, messageId, timespan);
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task Delete(MessageLink messageLink, ParsedTimespan timespan = null)
{
if (messageLink.Channel is not ITextChannel tc)
return;
await Delete(tc, messageLink.Message.Id, timespan);
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async Task Delete(ITextChannel channel, ulong messageId, ParsedTimespan timespan = null)
@ -373,7 +383,8 @@ public partial class Administration : EllieModule<AdministrationService>
if (ctx.Channel is not SocketTextChannel stc)
return;
var t = stc.Threads.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase));
var t = stc.Threads.FirstOrDefault(
x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase));
if (t is null)
{

View file

@ -111,8 +111,20 @@ public partial class OpenAiApiSession : IChatterBotSession
});
var dataString = await data.Content.ReadAsStringAsync();
try
{
data.EnsureSuccessStatusCode();
}
catch (Exception ex)
{
Log.Error(ex, "Failed to get response from OpenAI: {Message}", ex.Message);
return new Error<string>("Failed to get response from OpenAI");
}
try
{
var response = JsonConvert.DeserializeObject<OpenAiCompletionResponse>(dataString);
// Log.Information("Received response: {Response} ", dataString);

View file

@ -4134,7 +4134,11 @@ edit:
text:
desc: "The new text content of the edited message."
delete:
desc: Deletes a single message given the channel and message ID. If channel is ommited, message will be searched for in the current channel. You can also specify time parameter after which the message will be deleted (up to 7 days). This timer won't persist through bot restarts.
desc: |-
Deletes a single message given the channel and message ID, or a message link.
If channel is omitted, message will be searched for in the current channel.
You can also specify time parameter after which the message will be deleted (up to 7 days).
This timer won't persist through bot restarts.
ex:
- '#chat 771562360594628608'
- 771562360594628608
@ -4144,6 +4148,10 @@ delete:
desc: "The id of a specific message within a channel, used to target the deletion operation."
time:
desc: "The duration after which the message should be automatically deleted."
- messageLink:
desc: "The link of the message to delete. It must be on the same server."
time:
desc: "The duration after which the message should be automatically deleted."
- channel:
desc: "The channel where the message is located or should be searched for."
messageId: