mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
Added image attachment support for .ea if you omit imageUrl
This commit is contained in:
@@ -6,6 +6,9 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
|||||||
|
|
||||||
## [3.0.9] - 21.11.2021
|
## [3.0.9] - 21.11.2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- `.ea` will now use an image attachments if you omit imageUrl
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added `.emojiadd` with 3 overloads
|
- Added `.emojiadd` with 3 overloads
|
||||||
- `.ea :customEmoji:` which copies another server's emoji
|
- `.ea :customEmoji:` which copies another server's emoji
|
||||||
|
@@ -286,7 +286,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
[Priority(0)]
|
[Priority(2)]
|
||||||
public Task EmojiAdd(string name, Emote emote)
|
public Task EmojiAdd(string name, Emote emote)
|
||||||
=> EmojiAdd(name, emote.Url);
|
=> EmojiAdd(name, emote.Url);
|
||||||
|
|
||||||
@@ -294,6 +294,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
|
[Priority(1)]
|
||||||
public Task EmojiAdd(Emote emote)
|
public Task EmojiAdd(Emote emote)
|
||||||
=> EmojiAdd(emote.Name, emote.Url);
|
=> EmojiAdd(emote.Name, emote.Url);
|
||||||
|
|
||||||
@@ -301,9 +302,16 @@ namespace NadekoBot.Modules.Utility
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
[RequireBotPermission(GuildPermission.ManageEmojis)]
|
||||||
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
[RequireUserPermission(GuildPermission.ManageEmojis)]
|
||||||
public async Task EmojiAdd(string name, string url)
|
[Priority(0)]
|
||||||
|
public async Task EmojiAdd(string name, string url = null)
|
||||||
{
|
{
|
||||||
name = name.Trim(':');
|
name = name.Trim(':');
|
||||||
|
|
||||||
|
url ??= ctx.Message.Attachments.FirstOrDefault()?.Url;
|
||||||
|
|
||||||
|
if (url is null)
|
||||||
|
return;
|
||||||
|
|
||||||
using var http = _httpFactory.CreateClient();
|
using var http = _httpFactory.CreateClient();
|
||||||
var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
var res = await http.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
||||||
if (!res.IsImage() || res.GetImageSize() is null or > 262_144)
|
if (!res.IsImage() || res.GetImageSize() is null or > 262_144)
|
||||||
|
@@ -1200,6 +1200,7 @@ emojiadd:
|
|||||||
Adds the specified emoji to this server.
|
Adds the specified emoji to this server.
|
||||||
You can specify a name before the emoji to add it under a different name.
|
You can specify a name before the emoji to add it under a different name.
|
||||||
You can specify a name followed by an image link to add a new emoji from an image.
|
You can specify a name followed by an image link to add a new emoji from an image.
|
||||||
|
You can omit imageUrl and instead upload the image as an attachment.
|
||||||
Image size has to be below 256KB.
|
Image size has to be below 256KB.
|
||||||
args:
|
args:
|
||||||
- ":someonesCustomEmoji:"
|
- ":someonesCustomEmoji:"
|
||||||
|
Reference in New Issue
Block a user