commands.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:TnyBot-Discord 作者: 00firestar00 项目源码 文件源码
def insert(self, name: str, command: str, server: Server):
        """ Inserts a new command into the table.
        """
        if not name or not command:  # pragma: no cover
            # TODO: raise some exception
            return False

        if self.sql_type is SQLType.sqlite:
            return await self._insert_lite(name, command, server)
        else:  # pragma: no cover
            self.cursor.execute(
                self.query("INSERT INTO commands VALUES (%(name)s, %(command)s, %(server)s) ON CONFLICT DO NOTHING"),
                {"name": name, "command": command, "server": server.id})
            self.connection.commit()
            if self.cursor.rowcount > 0:
                return True
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号