fixing pylint errors
This commit is contained in:
parent
c9fa4a2845
commit
3d26748dfc
1 changed files with 8 additions and 8 deletions
16
main.py
16
main.py
|
@ -15,13 +15,13 @@ prefix = os.getenv('PREFIX')
|
||||||
|
|
||||||
class Client(commands.CommandsClient):
|
class Client(commands.CommandsClient):
|
||||||
# This class contains all of the commands the bot uses.
|
# This class contains all of the commands the bot uses.
|
||||||
async def get_prefix(self, message: revolt.Message, input: str | None = None):
|
async def get_prefix(self, message: revolt.Message, input: str | None = None): # pylint: disable=W0622
|
||||||
if input is None:
|
if input is None:
|
||||||
return prefix
|
return prefix
|
||||||
return input
|
return input
|
||||||
|
|
||||||
async def on_message(self, message: revolt.Message):
|
async def on_message(self, message: revolt.Message):
|
||||||
if 'PREFIX' not in os.environ or prefix == None:
|
if 'PREFIX' not in os.environ or prefix is None:
|
||||||
if message.author == self.user.owner:
|
if message.author == self.user.owner:
|
||||||
await message.channel.send("You have started the bot without setting the `prefix` environment variable!\nIt has been set to `temp!` automatically, please change it using `temp!prefix <new prefix>`.")
|
await message.channel.send("You have started the bot without setting the `prefix` environment variable!\nIt has been set to `temp!` automatically, please change it using `temp!prefix <new prefix>`.")
|
||||||
print("ERROR: prefix_env_var check failed! Prefix set to 'temp!'.")
|
print("ERROR: prefix_env_var check failed! Prefix set to 'temp!'.")
|
||||||
|
@ -58,17 +58,17 @@ class Client(commands.CommandsClient):
|
||||||
await ctx.message.reply(f"{avatar}")
|
await ctx.message.reply(f"{avatar}")
|
||||||
|
|
||||||
async def prefix_change(self, message: revolt.Message, new_prefix: str, silent: bool | None = False):
|
async def prefix_change(self, message: revolt.Message, new_prefix: str, silent: bool | None = False):
|
||||||
dotenv.set_key(env, 'PREFIX', new_prefix)
|
dotenv.set_key(env, 'PREFIX', new_prefix)
|
||||||
if silent is not True:
|
if silent is not True:
|
||||||
await message.reply(f"Prefix has been changed from `{prefix}` to `{new_prefix}`!")
|
await message.reply(f"Prefix has been changed from `{prefix}` to `{new_prefix}`!")
|
||||||
print(f"Prefix changed: {prefix} → {new_prefix}")
|
print(f"Prefix changed: {prefix} → {new_prefix}")
|
||||||
await Client.get_prefix(message, new_prefix)
|
await Client.get_prefix(message, new_prefix)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.is_bot_owner()
|
@commands.is_bot_owner()
|
||||||
async def prefix(self, ctx: commands.Context, new_prefix: str = None):
|
async def prefix(self, ctx: commands.Context, new_prefix: str = None):
|
||||||
# This command sets the bot's prefix. CURRENTLY PARTIALLY BROKEN
|
# This command sets the bot's prefix. CURRENTLY PARTIALLY BROKEN
|
||||||
if new_prefix is not None and commands.is_bot_owner == True:
|
if new_prefix is not None and True(commands.is_bot_owner):
|
||||||
await Client.prefix_change(self=self, message=ctx.message, new_prefix=new_prefix)
|
await Client.prefix_change(self=self, message=ctx.message, new_prefix=new_prefix)
|
||||||
else:
|
else:
|
||||||
await ctx.message.reply(f"The prefix is currently set to `{prefix}`.")
|
await ctx.message.reply(f"The prefix is currently set to `{prefix}`.")
|
||||||
|
|
Loading…
Reference in a new issue