Example #1
0
async def _delete_channel(ctx, alias):
    servers = rw_json.open_json('servers.json')
    if alias in servers[str(ctx.guild.id)]['channels_aliases'].keys():
        del servers[str(ctx.guild.id)]['channels_aliases'][alias]
        rw_json.write_json('servers.json', servers)
        await ctx.send(f'`You are no longer have {alias} channel now`')
    else:
        await ctx.send(f"`You haven't set a channel as {alias} channel`")
Example #2
0
async def on_guild_join(guild):
    servers = rw_json.open_json('servers.json')
    servers[str(guild.id)] = {
        'server_id': str(guild.id),
        'server_name': str(guild.name),
        'prefix': '.',
        'channels_aliases': dict()
    }
    rw_json.write_json('servers.json', servers)
Example #3
0
async def _choose_role(ctx):
    servers = rw_json.open_json('servers.json')
    msg = string_cmd.get_response('choose_role')
    message = await ctx.send(msg)
    message_id = message.id
    servers[str(ctx.guild.id)]['role_message_id'] = str(message_id)
    await message.add_reaction('🟦')
    await message.add_reaction('🟧')

    rw_json.write_json('servers.json', servers)
Example #4
0
async def changeprefix(ctx, prefix):
    servers = rw_json.open_json('servers.json')
    servers[str(ctx.guild.id)]['prefix'] = prefix
    rw_json.write_json('servers.json', servers)
Example #5
0
async def on_guild_remove(guild):
    servers = rw_json.open_json('servers.json')
    servers.pop(str(guild.id))
    rw_json.write_json('servers.json', servers)
Example #6
0
async def _set_channel(ctx, alias):
    servers = rw_json.open_json('servers.json')
    servers[str(ctx.guild.id)]['channels_aliases'][alias] = str(ctx.channel.id)
    rw_json.write_json('servers.json', servers)
    await ctx.send(f'`You have set this channel as {alias} channel`')