forked from EllieBotDevs/elliebot
.translate will now use 2 embeds
This commit is contained in:
parent
b3714d3c9e
commit
b03b32436b
1 changed files with 18 additions and 5 deletions
|
@ -28,9 +28,19 @@ public partial class Searches
|
||||||
await ctx.Channel.TriggerTypingAsync();
|
await ctx.Channel.TriggerTypingAsync();
|
||||||
var translation = await _service.Translate(fromLang, toLang, text);
|
var translation = await _service.Translate(fromLang, toLang, text);
|
||||||
|
|
||||||
var embed = CreateEmbed().WithOkColor().AddField(fromLang, text).AddField(toLang, translation);
|
var embed = CreateEmbed()
|
||||||
|
.WithOkColor()
|
||||||
|
.WithTitle(fromLang)
|
||||||
|
.WithDescription(text);
|
||||||
|
|
||||||
await Response().Embed(embed).SendAsync();
|
var embed2 = CreateEmbed()
|
||||||
|
.WithOkColor()
|
||||||
|
.WithTitle(toLang)
|
||||||
|
.WithDescription(translation);
|
||||||
|
|
||||||
|
await Response()
|
||||||
|
.Embeds([embed, embed2])
|
||||||
|
.SendAsync();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -65,7 +75,10 @@ public partial class Searches
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task AutoTransLang(string fromLang, string toLang)
|
public async Task AutoTransLang(string fromLang, string toLang)
|
||||||
{
|
{
|
||||||
var succ = await _service.RegisterUserAsync(ctx.User.Id, ctx.Channel.Id, fromLang.ToLower(), toLang.ToLower());
|
var succ = await _service.RegisterUserAsync(ctx.User.Id,
|
||||||
|
ctx.Channel.Id,
|
||||||
|
fromLang.ToLower(),
|
||||||
|
toLang.ToLower());
|
||||||
|
|
||||||
if (succ is null)
|
if (succ is null)
|
||||||
{
|
{
|
||||||
|
@ -89,8 +102,8 @@ public partial class Searches
|
||||||
var langs = _service.GetLanguages().ToList();
|
var langs = _service.GetLanguages().ToList();
|
||||||
|
|
||||||
var eb = CreateEmbed()
|
var eb = CreateEmbed()
|
||||||
.WithTitle(GetText(strs.supported_languages))
|
.WithTitle(GetText(strs.supported_languages))
|
||||||
.WithOkColor();
|
.WithOkColor();
|
||||||
|
|
||||||
foreach (var chunk in langs.Chunk(15))
|
foreach (var chunk in langs.Chunk(15))
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue