예제 #1
0
from constants import db, checks
from tables import muted_roles as roles

name = 'setmuted'
names = ['setmuted', 'mutedrole']
desc = 'Set the muted role for the server.'
examples = ['705538476698763324', '644334910810619924']
notes = 'The usage of the `mute` and `unmute` commands will not be available until this is used.'
reqperms = ['manage guild', 'manage roles']
reqargs = ['args', 'g', 'c']
cargs = [{
    'name': 'role ID',
    'aname': 'role',
    'optional': False,
    'excarg': 'g',
    'check': lambda a, g: checks.cid(a, g.get_role),
    'errmsg': 'Please provide a valid role ID in this server.'
}]


async def run(**env):
    for _, a in enumerate(env):
        globals().update({a: env.get(a)})

    fetched = db.fetch(roles, {'guild': g.id})

    if fetched:
        row = fetched.fetchone()
        if row.id == role.id:
            return await c.send('This role is already the muted role.')
예제 #2
0
from constants import checks

name = 'kick'
names = ['kick', 'softban']
desc = 'Kick a user from the server.'
examples = ['id1 don\'t do that again', 'id2']
notes = 'The user is DMed upon being kicked. Additionally, '\
'by default, they are given a one-time invite to rejoin with.'
reqperms = ['kick members', 'create instant invite']
reqargs = ['args', 'msg', 'g', 'c', 'm', 'conf']
cargs = [{
    'name': 'user mention/id',
    'aname': 'mem',
    'optional': False,
    'excarg': 'g',
    'check': lambda a, g: checks.cid(a, g.get_member),
    'errmsg': 'Please provide a member to kick.'
}, {
    'name': 'reason',
    'optional': True,
    'default': 'None'
}]


async def run(**env):
    for _, a in enumerate(env):
        globals().update({a: env.get(a)})

    try:
        await checks.roles(m, mem, g, c)
    except:
예제 #3
0
        return user
    return False


name = 'ban'
names = ['ban', 'snipe']
desc = 'Ban a user from the server.'
examples = ['id1 dumb stupid', '728694582086205550 leaving won\'t save you']
notes = 'The user is DMed upon being banned.'
reqperms = ['ban members']
reqargs = ['g', 'c', 'm', 'conf']
cargs = [{
    'name': 'user mention/id',
    'aname': 'user',
    'optional': False,
    'check': lambda a: checks.cid(a, safe_get),
    'errmsg': 'Please provide a valid user mention or ID to ban.'
}, {
    'name': 'reason',
    'optional': True,
    'default': 'None'
}]


async def run(**env):
    for _, a in enumerate(env):
        globals().update({a: env.get(a)})

    mem = g.get_member(user.id)
    if mem:
        try: