mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 15:57:53 +00:00
fix(bot): generate and attach color previews
This commit is contained in:
parent
497bee9487
commit
3ad28eb15f
5 changed files with 47 additions and 15 deletions
|
|
@ -82,7 +82,7 @@ public class Context
|
|||
internal readonly ModelRepository Repository;
|
||||
internal readonly RedisService Redis;
|
||||
|
||||
public async Task<Message> Reply(string text = null, Embed embed = null, AllowedMentions? mentions = null)
|
||||
public async Task<Message> Reply(string text = null, Embed embed = null, AllowedMentions? mentions = null, MultipartFile[]? files = null)
|
||||
{
|
||||
var botPerms = await BotPermissions;
|
||||
|
||||
|
|
@ -92,6 +92,9 @@ public class Context
|
|||
|
||||
if (embed != null && !botPerms.HasFlag(PermissionSet.EmbedLinks))
|
||||
throw new PKError("PluralKit does not have permission to send embeds in this channel. Please ensure I have the **Embed Links** permission enabled.");
|
||||
|
||||
if (files != null && !botPerms.HasFlag(PermissionSet.AttachFiles))
|
||||
throw new PKError("PluralKit does not have permission to attach files in this channel. Please ensure I have the **Attach Files** permission enabled.");
|
||||
|
||||
var msg = await Rest.CreateMessage(Channel.Id, new MessageRequest
|
||||
{
|
||||
|
|
@ -99,7 +102,7 @@ public class Context
|
|||
Embeds = embed != null ? new[] { embed } : null,
|
||||
// Default to an empty allowed mentions object instead of null (which means no mentions allowed)
|
||||
AllowedMentions = mentions ?? new AllowedMentions()
|
||||
});
|
||||
}, files: files);
|
||||
|
||||
// store log of sent message, so it can be queried or deleted later
|
||||
// skip DMs as DM messages can always be deleted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue