Miscellaneous

This section documents everything in the commands extension that doesn’t fit into any other section, but isn’t big enough to have its own section.

Classes

Paginator

Methods
class disnake.ext.commands.Paginator(prefix='```', suffix='```', max_size=2000, linesep='\n')[source]

A class that aids in paginating code blocks for Discord messages.

len(x)

Returns the total number of characters in the paginator.

prefix

The prefix inserted to every page. e.g. three backticks.

Type:

str

suffix

The suffix appended at the end of every page. e.g. three backticks.

Type:

str

max_size

The maximum amount of codepoints allowed in a page.

Type:

int

linesep
The character string inserted between lines. e.g. a newline character.

New in version 1.7.

Type:

str

clear()[source]

Clears the paginator to have no pages.

add_line(line='', *, empty=False)[source]

Adds a line to the current page.

If the line exceeds the max_size then an exception is raised.

Parameters:
  • line (str) – The line to add.

  • empty (bool) – Whether another empty line should be added.

Raises:

RuntimeError – The line was too big for the current max_size.

close_page()[source]

Prematurely terminate a page.

property pages[source]

Returns the rendered list of pages.

Type:

List[str]