Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discord python handle cogs

@commands.command(hidden=True)
async def load(self, ctx, *, module: str):
    """Loads a module."""
    try:
        await self.bot.load_extension(module)
    except commands.ExtensionError as e:
        await ctx.send(f'{e.__class__.__name__}: {e}')
    else:
        await ctx.send('N{OK HAND SIGN}')

@commands.command(hidden=True)
async def unload(self, ctx, *, module: str):
    """Unloads a module."""
    try:
        await self.bot.unload_extension(module)
    except commands.ExtensionError as e:
        await ctx.send(f'{e.__class__.__name__}: {e}')
    else:
        await ctx.send('N{OK HAND SIGN}')

@commands.group(name='reload', hidden=True, invoke_without_command=True)
async def _reload(self, ctx, *, module: str):
    """Reloads a module."""
    try:
        await self.bot.reload_extension(module)
    except commands.ExtensionError as e:
        await ctx.send(f'{e.__class__.__name__}: {e}')
    else:
        await ctx.send('N{OK HAND SIGN}')
Comment

PREVIOUS NEXT
Code Example
Python :: how to create templates in python 
Python :: how to remove item from list in python 
Python :: python get file size 
Python :: how to make loop python 
Python :: how to import packages in python 
Python :: python add 
Python :: python3 -m venv venv 
Python :: sequence python 
Python :: Python Map Function Syntax 
Python :: site:*.instagram.com 
Python :: login system in django 
Python :: indefinite loops python 
Python :: librosa from array to audio 
Python :: InsertionSort 
Python :: locate certificate path python 
Python :: load py file converted from .ui file 
Python :: Python program for getting url, hostname, port numbers 
Python :: python russian roulette 
Python :: b-spline quantile regression with statsmodels 
Python :: python django creating products 
Python :: python moref id vsphere 
Python :: # str and int mixup in python: 
Python :: sqlite3.operationalerror no such column version 
Python :: Cannot seem to use import time and import datetime in same script in Python 
Python :: "not equal to" python symbol 
Python :: pytest rerun last failed 
Python :: let in python 
Python :: Insert Multiple Images to Excel with Python 
Python :: cvhaardetectobjects 
Python :: Jhoom.In 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =