Skip to content

Commit

Permalink
[#67] Pages are now EmbedBuilder-backed and use builder syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Aug 9, 2021
1 parent 9ce0047 commit 925d82f
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -566,12 +569,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -632,12 +638,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -695,12 +704,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -786,12 +798,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -849,12 +864,15 @@ class MappingsExtension : Extension() {

pages.forEach {
pagesObj.addPage(
Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand Down Expand Up @@ -944,12 +962,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for more",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand All @@ -958,12 +979,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for less",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}
}
Expand Down Expand Up @@ -1047,12 +1071,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for more",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand All @@ -1061,12 +1088,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for less",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}
}
Expand Down Expand Up @@ -1150,12 +1180,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for more",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}

Expand All @@ -1164,12 +1197,15 @@ class MappingsExtension : Extension() {
pagesObj.addPage(
"${EXPAND_EMOJI.mention} for less",

Page(
description = it,
title = pageTitle,
footer = PAGE_FOOTER,
footerIcon = PAGE_FOOTER_ICON
)
Page {
description = it
title = pageTitle

footer {
text = PAGE_FOOTER
icon = PAGE_FOOTER_ICON
}
}
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,39 @@ public class HelpExtension : HelpProvider, Extension() {
pages.addPage(
COMMANDS_GROUP,

Page(
description = page.joinToString("\n\n") { "${it.first}\n${it.second}" },
title = translationsProvider.translate("extensions.help.paginator.title.commands", locale),
footer = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(totalCommands)
),
Page {
description = page.joinToString("\n\n") { "${it.first}\n${it.second}" }
title = translationsProvider.translate("extensions.help.paginator.title.commands", locale)

footer {
text = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(totalCommands)
)
}

color = settings.colourGetter(event)
)
}
)

pages.addPage(
ARGUMENTS_GROUP,

Page(
description = page.joinToString("\n\n") { "${it.first}\n${it.third}" },
title = translationsProvider.translate("extensions.help.paginator.title.arguments", locale),
footer = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(totalCommands)
),
Page {
description = page.joinToString("\n\n") { "${it.first}\n${it.third}" }
title = translationsProvider.translate("extensions.help.paginator.title.arguments", locale)

footer {
text = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(totalCommands)
)
}

color = settings.colourGetter(event)
)
}
)
}

Expand All @@ -124,16 +132,18 @@ public class HelpExtension : HelpProvider, Extension() {

pages.addPage(
COMMANDS_GROUP,
Page(
description = translationsProvider.translate("extensions.help.paginator.noCommands", locale),
title = translationsProvider.translate("extensions.help.paginator.noCommands", locale),
footer = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(0)
),
Page {
description = translationsProvider.translate("extensions.help.paginator.noCommands", locale)
title = translationsProvider.translate("extensions.help.paginator.noCommands", locale)
footer {
text = translationsProvider.translate(
"extensions.help.paginator.footer",
locale,
replacements = arrayOf(0)
)
}
color = settings.colourGetter(event)
)
}
)
}

Expand Down Expand Up @@ -179,19 +189,19 @@ public class HelpExtension : HelpProvider, Extension() {
pages.addPage(
COMMANDS_GROUP,

Page(
color = settings.colourGetter(event),
Page {
color = settings.colourGetter(event)

description = translationsProvider.translate(
"extensions.help.error.missingCommandDescription",
locale
),
)

title = translationsProvider.translate(
"extensions.help.error.missingCommandTitle",
locale
)
)
}
)
} else {
val (openingLine, desc, arguments) = formatCommandHelp(prefix, event, command, longDescription = true)
Expand All @@ -207,16 +217,16 @@ public class HelpExtension : HelpProvider, Extension() {
pages.addPage(
COMMANDS_GROUP,

Page(
color = settings.colourGetter(event),
description = "$openingLine\n$desc\n\n$arguments",
Page {
color = settings.colourGetter(event)
description = "$openingLine\n$desc\n\n$arguments"

title = translationsProvider.translate(
"extensions.help.paginator.title.command",
locale,
replacements = arrayOf(commandName)
)
)
}
)
}

Expand Down
Loading

0 comments on commit 925d82f

Please sign in to comment.