More cleanup
This commit is contained in:
parent
9892de7c2e
commit
027690b3d7
2 changed files with 40 additions and 50 deletions
|
@ -1,4 +1,3 @@
|
|||
#nullable disable
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using EllieBot.Modules.Searches.Common;
|
||||
using EllieBot.Modules.Searches.Services;
|
||||
|
@ -114,7 +113,7 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task Movie([Leftover] string query = null)
|
||||
public async Task Movie([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
|
@ -166,7 +165,7 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task Lmgtfy([Leftover] string smh = null)
|
||||
public async Task Lmgtfy([Leftover] string smh)
|
||||
{
|
||||
if (!await ValidateQuery(smh))
|
||||
return;
|
||||
|
@ -198,6 +197,7 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
.SendAsync();
|
||||
}
|
||||
|
||||
|
||||
[Cmd]
|
||||
public async Task MagicTheGathering([Leftover] string search)
|
||||
{
|
||||
|
@ -255,21 +255,23 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task UrbanDict([Leftover] string query = null)
|
||||
public async Task UrbanDict([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
|
||||
await ctx.Channel.TriggerTypingAsync();
|
||||
using (var http = _httpFactory.CreateClient())
|
||||
{
|
||||
var res = await http.GetStringAsync(
|
||||
$"https://api.urbandictionary.com/v0/define?term={Uri.EscapeDataString(query)}");
|
||||
try
|
||||
{
|
||||
var allItems = JsonConvert.DeserializeObject<UrbanResponse>(res).List;
|
||||
if (allItems.Any())
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var res = await http.GetStringAsync($"https://api.urbandictionary.com/v0/define?"
|
||||
+ $"term={Uri.EscapeDataString(query)}");
|
||||
var allItems = JsonConvert.DeserializeObject<UrbanResponse>(res)?.List;
|
||||
|
||||
if (allItems is null or { Length: 0 })
|
||||
{
|
||||
await Response().Error(strs.ud_error).SendAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await Response()
|
||||
.Paginated()
|
||||
.Items(allItems)
|
||||
|
@ -285,15 +287,6 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
.WithDescription(item.Definition);
|
||||
})
|
||||
.SendAsync();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
await Response().Error(strs.ud_error).SendAsync();
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
|
@ -350,7 +343,7 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
[Cmd]
|
||||
public async Task Wiki([Leftover] string query)
|
||||
{
|
||||
query = query?.Trim();
|
||||
query = query.Trim();
|
||||
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
|
@ -392,16 +385,17 @@ public partial class Searches : EllieModule<SearchesService>
|
|||
for (var i = 0; i < colorObjects.Length; i++)
|
||||
{
|
||||
var x = i * 50;
|
||||
img.Mutate(m => m.FillPolygon(colorObjects[i], new(x, 0), new(x + 50, 0), new(x + 50, 50), new(x, 50)));
|
||||
var j = i;
|
||||
img.Mutate(m => m.FillPolygon(colorObjects[j], new(x, 0), new(x + 50, 0), new(x + 50, 50), new(x, 50)));
|
||||
}
|
||||
|
||||
await using var ms = img.ToStream();
|
||||
await using var ms = await img.ToStreamAsync();
|
||||
await ctx.Channel.SendFileAsync(ms, "colors.png");
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Avatar([Leftover] IGuildUser usr = null)
|
||||
public async Task Avatar([Leftover] IGuildUser? usr = null)
|
||||
{
|
||||
usr ??= (IGuildUser)ctx.User;
|
||||
|
||||
|
|
|
@ -63,10 +63,8 @@ greet:
|
|||
greetmsg:
|
||||
desc: |-
|
||||
Sets a new join announcement message which will be shown in the current channel.
|
||||
Write `%user.mention%` if you want to mention the new member.
|
||||
Full list of placeholders can be found here <https://docs.elliebot.net/ellie/features/placeholders/>
|
||||
Using this command with no message will show the current greet message.
|
||||
You can use embed json from <https://eb.elliebot.net/> instead of regular text, if you want the message to be embedded.
|
||||
Supports [placeholders](https://docs.elliebot.net/ellie/features/placeholders/) and [embeds](https://eb.elliebot.net/)
|
||||
ex:
|
||||
- Welcome, %user.mention%.
|
||||
params:
|
||||
|
@ -81,10 +79,8 @@ bye:
|
|||
byemsg:
|
||||
desc: |-
|
||||
Sets a new leave announcement message which will be shown in the current channel.
|
||||
Type `%user.name%` to show the name of the user who left.
|
||||
Full list of placeholders can be found here <https://docs.elliebot.net/ellie/features/placeholders/>
|
||||
Using this command with no message will show the current bye message.
|
||||
You can use embed json from <https://eb.elliebot.net/> instead of regular text, if you want the message to be embedded.
|
||||
Supports [placeholders](https://docs.elliebot.net/ellie/features/placeholders/) and [embeds](https://eb.elliebot.net/)
|
||||
ex:
|
||||
- '%user.name% has left.'
|
||||
params:
|
||||
|
@ -113,7 +109,9 @@ greettest:
|
|||
- user:
|
||||
desc: "The user to impersonate when sending the greeting, defaulting to yourself if not specified."
|
||||
boosttest:
|
||||
desc: Sends the boost message in the current channel as if you just boosted the server. You can optionally specify a different user.
|
||||
desc: |-
|
||||
Sends the boost message in the current channel as if you just boosted the server.
|
||||
You can optionally specify a different user.
|
||||
ex:
|
||||
- ''
|
||||
- '@SomeoneElse'
|
||||
|
@ -145,10 +143,8 @@ boost:
|
|||
boostmsg:
|
||||
desc: |-
|
||||
Sets a new boost announcement message which will be shown in the current channel.
|
||||
Type `%user.mention%` if you want to mention the booster.
|
||||
Full list of placeholders can be found here <https://docs.elliebot.net/ellie/features/placeholders/>
|
||||
Using this command with no message will show the current boost message.
|
||||
You can use embed json from <https://eb.elliebot.net/> instead of regular text, if you want the message to be embedded.
|
||||
Supports [placeholders](https://docs.elliebot.net/ellie/features/placeholders/) and [embeds](https://eb.elliebot.net/)
|
||||
ex:
|
||||
- '%user.mention% has boosted the server!!!'
|
||||
params:
|
||||
|
@ -3083,7 +3079,7 @@ banmessage:
|
|||
- '{{ "description": "%ban.user% you have been banned from %server.name% by %ban.mod%" }}'
|
||||
params:
|
||||
- message:
|
||||
desc: "The custom message to be displayed when a user is banned from the server, allowing for placeholders to be replaced with relevant information."
|
||||
desc: "The custom message to be displayed when a user is banned from the server."
|
||||
banmessagetest:
|
||||
desc: If ban message is not disabled, bot will send you the message as if you were banned by yourself. Used for testing the ban message.
|
||||
ex:
|
||||
|
|
Loading…
Reference in a new issue