Added required argument to Paginator instances
This commit is contained in:
parent
cb7290be00
commit
222159f059
@ -193,7 +193,7 @@ class Admin:
|
||||
@commands.command()
|
||||
@commands.is_owner()
|
||||
async def view_code(self, ctx, code_name):
|
||||
pag = utils.Paginator(prefix='```py', suffix='```')
|
||||
pag = utils.Paginator(self.bot, prefix='```py', suffix='```')
|
||||
pag.add(inspect.getsource(self.bot.get_command(code_name).callback))
|
||||
for page in pag.pages():
|
||||
await ctx.send(page)
|
||||
|
||||
@ -141,7 +141,7 @@ class Repl:
|
||||
fmt = '{}'.format(value)
|
||||
try:
|
||||
if fmt is not None:
|
||||
pag = Paginator()
|
||||
pag = Paginator(self.bot)
|
||||
pag.add(fmt)
|
||||
for page in pag.pages():
|
||||
await response.channel.send(page)
|
||||
@ -157,7 +157,7 @@ class Repl:
|
||||
return
|
||||
try:
|
||||
body = self.cleanup_code(body)
|
||||
pag = Paginator()
|
||||
pag = Paginator(self.bot)
|
||||
pag.add(await asyncio.wait_for(self.bot.loop.create_task(run_command(body)), 10))
|
||||
for page in pag.pages():
|
||||
await ctx.send(page)
|
||||
|
||||
@ -128,9 +128,16 @@ class Paginator:
|
||||
self._inline_char = inline_char
|
||||
self._embed_title = ''
|
||||
self._embed_description = ''
|
||||
self._embed_color = None
|
||||
self._embed_thumbnail = None
|
||||
self._embed_url = None
|
||||
self._bot = bot
|
||||
|
||||
def set_embed_meta(self, title: str='\uFFF0', description: str='\uFFF0'):
|
||||
def set_embed_meta(self, title: str='\uFFF0',
|
||||
description: str='\uFFF0',
|
||||
color: discord.Colour=None,
|
||||
thumbnail: str=None,
|
||||
url: str=None):
|
||||
if len(title) <= self._max_field_name:
|
||||
self._embed_title = title
|
||||
else:
|
||||
@ -139,6 +146,9 @@ class Paginator:
|
||||
self._embed_description = description
|
||||
else:
|
||||
raise RuntimeError('Provided Description is too long')
|
||||
self._embed_color = color
|
||||
self._embed_thumbnail = thumbnail
|
||||
self._embed_url = url
|
||||
|
||||
def pages(self) -> typing.List[str]:
|
||||
_pages = list()
|
||||
@ -244,6 +254,12 @@ class Paginator:
|
||||
description=self._embed_description,
|
||||
color=self._bot.embed_color,
|
||||
)
|
||||
if self._embed_thumbnail:
|
||||
em.set_thumbnail(url=self._embed_thumbnail)
|
||||
if self._embed_url:
|
||||
em.url = self._embed_url
|
||||
if self._embed_color:
|
||||
em.color = self._embed_color
|
||||
em.set_footer(text=f'{i + 1}/{_len_pages}')
|
||||
for field in page:
|
||||
em.add_field(name=field['name'], value=field['value'], inline=field['inline'])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user