add alliance cmd
This commit is contained in:
1 parent
90740244d3
commit
b5863b9e27
3 files changed
+151
-6
No files matched your search
+23
-2
@@ -28,6 +28,26 @@ class CustomCtx(Context):
|
||||
**kwargs,
|
||||
):
|
||||
await self.Paginator(pages=pages, pagetype=pagetype).start(ctx=self, **kwargs)
|
||||
|
||||
async def cbsend(self, content: Optional[str] = None, lang: Optional[str] = "py"):
|
||||
"""
|
||||
send content in a paginated codeblock
|
||||
"""
|
||||
codeblock = "```" + lang + "\n{}" + "\n```"
|
||||
if not len(content) > 1200:
|
||||
await self.send(content=codeblock.format(content))
|
||||
return
|
||||
pages = []
|
||||
string = ""
|
||||
for p in content.splitlines("\n"):
|
||||
if not len(string) > 1900:
|
||||
string += p
|
||||
else:
|
||||
pages.append(codeblock.format(string))
|
||||
string = ""
|
||||
string += p
|
||||
await self.paginate(pages=pages, pagetype="text")
|
||||
|
||||
|
||||
|
||||
class Brahmos(Bot):
|
||||
@@ -48,12 +68,13 @@ class Brahmos(Bot):
|
||||
return False
|
||||
|
||||
async def setup_hook(self):
|
||||
if self.db_pool is None:
|
||||
self.db_pool = await create_db_pool()
|
||||
print(f"logged in as: {self.user.name}")
|
||||
await self.load_extension("jishaku")
|
||||
for ext in self.exts:
|
||||
await self.load_extension(f"exts.{ext}")
|
||||
if self.db_pool is None:
|
||||
self.db_pool = await create_db_pool()
|
||||
|
||||
|
||||
async def get_context(self, message, *, cls=CustomCtx):
|
||||
return await super().get_context(message, cls=cls)
|
||||
|
||||
Reference in new issue
Block a user