尝试添加不一致的cog

np8igboo  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(184)

我试图从replit中添加一个不和谐的cog,它不是我的。我对齿轮一点经验都没有,所以这让我很困惑。我让bot工作,但是实际的sudo命令不工作,因为它不理解您在其中输入给sudo的消息。我该如何修理机器人?

from copy import copy

import discord
from discord.ext import commands

__version__ = "1.0.0"

class SudoCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(
        hidden = True
    )
    #@commands.is_owner()
    async def sudo(self, ctx, victim: discord.Member, *, command):
        """Take control."""
        new_message = copy(ctx.message)
        new_message.author = victim
        new_message.content = ctx.prefix + command
        await self.bot.process_commands(new_message)

def setup(bot):
    bot.add_cog(SudoCog(bot))

编辑:这里是第二个python文件

import re
from pathlib import Path
import setuptools

def getLongDescription():
    with open("README.md", "r") as fh:
        longDescription = fh.read()
    return longDescription

def getRequirements():
    requirements = []
    with open("requirements.txt") as f:
        requirements = f.read().splitlines()
    return requirements

def getVersion():
    path = Path(__file__).parent.resolve() / "sudo.py"
    with open(path, "r") as fp:
        version_file = fp.read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
    if not version_match:
        raise RuntimeError("Unable to find version string.")
    version = version_match.group(1)
    return version

setuptools.setup(
    name="DigiSudo",
    version=getVersion(),
    author="DigiDuncan",
    author_email="digiduncan@gmail.com",
    description="Sudo command cog for discord.py.",
    long_description=getLongDescription(),
    long_description_content_type="text/markdown",
    url="https://github.com/DigiDuncan/DigiSudo",
    python_requires=">=3.7",
    install_requires=getRequirements(),
    py_modules=["sudo"],
    include_package_data=True,
    classifiers=[
        "Programming Language :: Python :: 3.7",
        "Operating System :: OS Independent",
        "License :: OSI Approved :: GNU General Public License v3 (GPLv3)"
    ]
)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题