Пример #1
0
    def __init__(self, bot):
        self.bot = bot
        self.db = sql_con()

        self._GRANT = 0
        self._DENY = 1
        self._CLEAR = 2
        self._OVERWRITE = 3
Пример #2
0
async def track(message, author=None):
    '''
	  ' Marks a message in the database so that it will be automatically
	  ' deleted if the sender or an admin reacts with the 'trash' emoji
	'''
    await message.add_reaction('🚮')
    sql_db = sql_con()
    aid = 0
    if author:
        aid = author.id
    with sql_cur(sql_db) as cur:
        cur.execute(
            "INSERT INTO tracked_messages (messid, sender_uid, track_time) VALUES (?, ?, ?);",
            (message.id, aid, message.created_at))
Пример #3
0
async def get_permissions(member, guild):
    tracked_roles = {}
    with sql_cur(sql_con()) as cur:
        cur.execute(
            'SELECT role_id,permissions FROM permissions WHERE guild_id=?',
            (guild.id, ))
        for role in cur.fetchall():
            tracked_roles[role[0]] = role[1]

    if len(tracked_roles) == 0:
        return 0

    permissions = 0

    for role in member.roles:
        if role.id in tracked_roles.keys():
            role_perms = tracked_roles[role.id]
            permissions = _perms_combine(role_perms, permissions)

    return permissions
Пример #4
0
def setup(bot):
    bot.add_cog(RPManager(bot, sql_con()))
Пример #5
0
def setup(bot):
    bot.add_cog(WAN(bot, sql_con()))
Пример #6
0
		await track(msg, ctx.author)
	
	@commands.command()
	async def invite(self, ctx):
		''' Return a URL to invite Mekhane to your server. '''
		global bot_url
		processed_url = bot_url.format(self.bot.user.id)
		embed = discord.Embed(title="Click here to invite {0} to your server.".format(self.bot.user), colour=discord.Colour(self.bot.embed_colour), url=processed_url)
		embed.set_author(name=str(self.bot.user), url=processed_url, icon_url=self.bot.user.avatar_url)
		embed.set_footer(text=processed_url)

		msg = await ctx.send(content="Invite me to your server!", embed=embed)
		await track(msg, ctx.author)


global_db_hook = sql_con()

mekhane = commands.Bot(command_prefix=bot_prefix, description=bot_desc)
mekhane.embed_colour = 0x9030d0
mekhane.add_cog(Mekhane_Core(mekhane, global_db_hook))
mekhane.load_extension('permissions')
mekhane.load_extension('mod.wan.wan')
mekhane.load_extension('mod.scp.scp')
#mekhane.load_extension('mod.rp.rp')

@mekhane.check
async def global_ensure_interact(ctx):
	return await permissions.has_permission(ctx, permissions.interact)

mekhane.run(bot_token) # Token is loaded from the file '.bot_info.json' - Rename 'bot-info.json.skel' to '.bot-info.json' and put your token there.