Made Pylint happy
This commit is contained in:
parent
8aec106671
commit
2c93e81be0
|
@ -4,12 +4,9 @@ from os import getenv
|
||||||
from naff import (
|
from naff import (
|
||||||
Client,
|
Client,
|
||||||
Intents,
|
Intents,
|
||||||
OptionTypes,
|
|
||||||
Permissions,
|
|
||||||
listen,
|
listen,
|
||||||
slash_command,
|
slash_command,
|
||||||
InteractionContext,
|
InteractionContext,
|
||||||
slash_option,
|
|
||||||
)
|
)
|
||||||
from naff.api import events
|
from naff.api import events
|
||||||
from naff.models.discord.embed import (
|
from naff.models.discord.embed import (
|
||||||
|
@ -19,10 +16,8 @@ from naff.models.discord.embed import (
|
||||||
EmbedFooter,
|
EmbedFooter,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from database import GuildSettings as GuildSettingsModel, JoinLeave
|
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
from database import GuildSettings as GuildSettingsModel, JoinLeave
|
||||||
|
|
||||||
bot = Client(intents=Intents.ALL, debug_scope=387153131378835456)
|
bot = Client(intents=Intents.ALL, debug_scope=387153131378835456)
|
||||||
|
|
||||||
|
@ -37,7 +32,7 @@ async def on_ready():
|
||||||
if guild_q is None:
|
if guild_q is None:
|
||||||
guild_q = GuildSettingsModel(guild_id=guild.id)
|
guild_q = GuildSettingsModel(guild_id=guild.id)
|
||||||
guild_q.save()
|
guild_q.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# @listen()
|
# @listen()
|
||||||
|
@ -84,7 +79,6 @@ async def on_member_leave(event: events.MemberRemove):
|
||||||
|
|
||||||
await channel.send(str(joinleave_q.leave_message).format(member=event.member, guild=event.guild))
|
await channel.send(str(joinleave_q.leave_message).format(member=event.member, guild=event.guild))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slash_command(name="ping", description="Ping the bot")
|
@slash_command(name="ping", description="Ping the bot")
|
||||||
|
@ -158,7 +152,7 @@ def main():
|
||||||
|
|
||||||
# Load extensions
|
# Load extensions
|
||||||
bot.load_extension("heimdallr.commands.admin")
|
bot.load_extension("heimdallr.commands.admin")
|
||||||
bot.load_extension("heimdallr.commands.gatekeep")
|
bot.load_extension("heimdallr.commands.gatekeep")
|
||||||
bot.load_extension("heimdallr.commands.quote")
|
bot.load_extension("heimdallr.commands.quote")
|
||||||
bot.load_extension("heimdallr.commands.infractions")
|
bot.load_extension("heimdallr.commands.infractions")
|
||||||
bot.load_extension("heimdallr.commands.self_roles")
|
bot.load_extension("heimdallr.commands.self_roles")
|
||||||
|
@ -167,4 +161,4 @@ def main():
|
||||||
bot.start(getenv("DISCORD_TOKEN"))
|
bot.start(getenv("DISCORD_TOKEN"))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# pylint: disable=consider-using-f-string
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from naff import (
|
from naff import (
|
||||||
|
|
|
@ -6,7 +6,6 @@ from naff import (
|
||||||
Client,
|
Client,
|
||||||
Extension,
|
Extension,
|
||||||
slash_command,
|
slash_command,
|
||||||
slash_option,
|
|
||||||
InteractionContext,
|
InteractionContext,
|
||||||
Modal,
|
Modal,
|
||||||
ParagraphText,
|
ParagraphText,
|
||||||
|
@ -22,7 +21,7 @@ from database import BotMessages as BotMessagesModel
|
||||||
# Template modal for creating/editing bot messages.
|
# Template modal for creating/editing bot messages.
|
||||||
message_creation_modal = Modal(
|
message_creation_modal = Modal(
|
||||||
custom_id="bot-message-create",
|
custom_id="bot-message-create",
|
||||||
title=f"Create a message as the bot",
|
title="Create a message as the bot",
|
||||||
components=[
|
components=[
|
||||||
ParagraphText(
|
ParagraphText(
|
||||||
custom_id="embeds",
|
custom_id="embeds",
|
||||||
|
@ -52,17 +51,16 @@ class BotMessages(Extension):
|
||||||
default_member_permissions=Permissions.MANAGE_GUILD,
|
default_member_permissions=Permissions.MANAGE_GUILD,
|
||||||
)
|
)
|
||||||
async def bot_message_create_command(self, ctx: InteractionContext):
|
async def bot_message_create_command(self, ctx: InteractionContext):
|
||||||
|
|
||||||
# Respond with the template modal. No values have been set in the modal, as it is
|
# Respond with the template modal. No values have been set in the modal, as it is
|
||||||
# a new message.
|
# a new message.
|
||||||
await ctx.send_modal(message_creation_modal)
|
await ctx.send_modal(message_creation_modal)
|
||||||
|
|
||||||
# Wait for the user to submit the modal, and ensure that we are receiving the
|
# Wait for the user to submit the modal, and ensure that we are receiving the
|
||||||
# correct modal.
|
# correct modal.
|
||||||
modal_ctx: ModalContext = await self.client.wait_for_modal(message_creation_modal, author=ctx.author)
|
modal_ctx: ModalContext = await self.client.wait_for_modal(message_creation_modal, author=ctx.author)
|
||||||
if modal_ctx.custom_id != "bot-message-create":
|
if modal_ctx.custom_id != "bot-message-create":
|
||||||
return
|
return
|
||||||
|
|
||||||
# Retrieve the values from the modal.
|
# Retrieve the values from the modal.
|
||||||
# Ensure that at least one of the fields is filled in, as a message cannot be
|
# Ensure that at least one of the fields is filled in, as a message cannot be
|
||||||
# empty.
|
# empty.
|
||||||
|
@ -84,7 +82,7 @@ class BotMessages(Extension):
|
||||||
# If the JSON is invalid, return an error.
|
# If the JSON is invalid, return an error.
|
||||||
embed: dict | None = None
|
embed: dict | None = None
|
||||||
embeds: list | None = None
|
embeds: list | None = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if embeds_string:
|
if embeds_string:
|
||||||
embeds_temp = json.loads(embeds_string)
|
embeds_temp = json.loads(embeds_string)
|
||||||
|
@ -98,7 +96,7 @@ class BotMessages(Extension):
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Send the bot message in the channel.
|
# Send the bot message in the channel.
|
||||||
msg = await ctx.channel.send(
|
msg = await ctx.channel.send(
|
||||||
content=content_string if content_string else None,
|
content=content_string if content_string else None,
|
||||||
|
@ -165,13 +163,13 @@ class BotMessages(Extension):
|
||||||
|
|
||||||
# Send the modal to the user
|
# Send the modal to the user
|
||||||
await ctx.send_modal(modal)
|
await ctx.send_modal(modal)
|
||||||
|
|
||||||
# Wait for the user to submit the modal, and ensure that we are receiving the
|
# Wait for the user to submit the modal, and ensure that we are receiving the
|
||||||
# correct modal.
|
# correct modal.
|
||||||
modal_ctx: ModalContext = await self.client.wait_for_modal(modal, author=ctx.author)
|
modal_ctx: ModalContext = await self.client.wait_for_modal(modal, author=ctx.author)
|
||||||
if modal_ctx.custom_id != "bot-message-edit":
|
if modal_ctx.custom_id != "bot-message-edit":
|
||||||
return
|
return
|
||||||
|
|
||||||
embeds_string: str = modal_ctx.responses["embeds"]
|
embeds_string: str = modal_ctx.responses["embeds"]
|
||||||
content_string: str = modal_ctx.responses["content"]
|
content_string: str = modal_ctx.responses["content"]
|
||||||
if (
|
if (
|
||||||
|
@ -186,7 +184,7 @@ class BotMessages(Extension):
|
||||||
|
|
||||||
embed: dict | None = None
|
embed: dict | None = None
|
||||||
embeds: list | None = None
|
embeds: list | None = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if embeds_string:
|
if embeds_string:
|
||||||
embeds_temp = json.loads(embeds_string)
|
embeds_temp = json.loads(embeds_string)
|
||||||
|
@ -200,7 +198,7 @@ class BotMessages(Extension):
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await message.edit(
|
await message.edit(
|
||||||
content=content_string if content_string else None,
|
content=content_string if content_string else None,
|
||||||
embed=embed,
|
embed=embed,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
import random, string
|
import random
|
||||||
|
import string
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from naff import (
|
from naff import (
|
||||||
Extension,
|
Extension,
|
||||||
|
@ -17,7 +18,6 @@ from naff import (
|
||||||
SlashCommandChoice,
|
SlashCommandChoice,
|
||||||
Button,
|
Button,
|
||||||
ButtonStyles,
|
ButtonStyles,
|
||||||
Embed,
|
|
||||||
)
|
)
|
||||||
from naff.api import events
|
from naff.api import events
|
||||||
from naff.models.discord.enums import Permissions
|
from naff.models.discord.enums import Permissions
|
||||||
|
@ -60,12 +60,12 @@ class Gatekeep(Extension):
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def set_type_command(self, ctx: InteractionContext, type: str):
|
async def set_type_command(self, ctx: InteractionContext, type_: str):
|
||||||
gk: GatekeepModel
|
gk: GatekeepModel
|
||||||
gk, _ = GatekeepModel.get_or_create(guild_id=ctx.guild.id)
|
gk, _ = GatekeepModel.get_or_create(guild_id=ctx.guild.id)
|
||||||
gk.gatekeep_method = type
|
gk.gatekeep_method = type_
|
||||||
gk.save()
|
gk.save()
|
||||||
await ctx.send(f"Gatekeep type set to {type}", ephemeral=True)
|
await ctx.send(f"Gatekeep type set to {type_}", ephemeral=True)
|
||||||
|
|
||||||
@slash_command(
|
@slash_command(
|
||||||
name="gatekeep",
|
name="gatekeep",
|
||||||
|
@ -193,7 +193,8 @@ class Gatekeep(Extension):
|
||||||
|
|
||||||
if not welcome_channel:
|
if not welcome_channel:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
f"{user.mention} has been approved.\nNB: No welcome channel has been set – attempting to DM {user.mention}",
|
(f"{user.mention} has been approved.\n"
|
||||||
|
f"NB: No welcome channel has been set – attempting to DM {user.mention}"),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
await user.send(
|
await user.send(
|
||||||
|
@ -204,7 +205,8 @@ class Gatekeep(Extension):
|
||||||
channel = await ctx.guild.fetch_channel(jl.message_channel)
|
channel = await ctx.guild.fetch_channel(jl.message_channel)
|
||||||
if not channel:
|
if not channel:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
f"{user.mention} has been approved.\nNB: No welcome channel has been set – attempting to DM {user.mention}",
|
(f"{user.mention} has been approved.\n"
|
||||||
|
f"NB: No welcome channel has been set – attempting to DM {user.mention}"),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
await user.send(
|
await user.send(
|
||||||
|
@ -406,10 +408,6 @@ class Gatekeep(Extension):
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setup(client: Client):
|
def setup(client: Client):
|
||||||
GatekeepModel.create_table()
|
GatekeepModel.create_table()
|
||||||
GatekeepCaptchasModel.create_table()
|
GatekeepCaptchasModel.create_table()
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# pylint: disable=unsubscriptable-object
|
||||||
import logging
|
import logging
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
from naff import (
|
from naff import (
|
||||||
|
@ -63,7 +64,6 @@ class Infractions(Extension):
|
||||||
# await ctx.send(embed=embeds, ephemeral=True)
|
# await ctx.send(embed=embeds, ephemeral=True)
|
||||||
paginator = Paginator.create_from_embeds(self.client, *embeds)
|
paginator = Paginator.create_from_embeds(self.client, *embeds)
|
||||||
await paginator.send(ctx)
|
await paginator.send(ctx)
|
||||||
paginator.send
|
|
||||||
|
|
||||||
@slash_command(
|
@slash_command(
|
||||||
name="user-infractions",
|
name="user-infractions",
|
||||||
|
@ -226,16 +226,16 @@ class Infractions(Extension):
|
||||||
|
|
||||||
guild_settings: Optional[GuildSettings] = GuildSettings.get_or_none(GuildSettings.guild_id == int(ctx.guild_id))
|
guild_settings: Optional[GuildSettings] = GuildSettings.get_or_none(GuildSettings.guild_id == int(ctx.guild_id))
|
||||||
if guild_settings is not None:
|
if guild_settings is not None:
|
||||||
if guild_settings.admin_channel is not None:
|
if guild_settings.admin_channel is not None:
|
||||||
admin_channel = await self.client.fetch_channel(int(guild_settings.admin_channel))
|
admin_channel = await self.client.fetch_channel(int(guild_settings.admin_channel))
|
||||||
if admin_channel is not None:
|
if admin_channel is not None:
|
||||||
await admin_channel.send(embed=Embed(
|
await admin_channel.send(embed=Embed(
|
||||||
title=f"Warned {user.display_name} ({user.username}#{user.discriminator}, {user.id})",
|
title=f"Warned {user.display_name} ({user.username}#{user.discriminator}, {user.id})",
|
||||||
description=f"{reason}",
|
description=f"{reason}",
|
||||||
color=infraction_colour(0x0000FF),
|
color=infraction_colour(0x0000FF),
|
||||||
fields=[
|
fields=[
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
|
|
||||||
if not silent and warning_msg is None:
|
if not silent and warning_msg is None:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
# pylint: disable=not-an-iterable
|
||||||
|
# pylint: disable=unsubscriptable-object
|
||||||
|
# pylint: disable=logging-fstring-interpolation
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
from time import sleep
|
from typing import List, Tuple
|
||||||
from typing import Dict, List, Tuple
|
|
||||||
from naff import (
|
from naff import (
|
||||||
Client,
|
Client,
|
||||||
Extension,
|
Extension,
|
||||||
|
@ -29,8 +31,8 @@ from naff import (
|
||||||
from naff.api import events
|
from naff.api import events
|
||||||
from naff.client.errors import HTTPException
|
from naff.client.errors import HTTPException
|
||||||
|
|
||||||
from database import Polls as PollsModel, PollVotes as PollVotesModel
|
|
||||||
from peewee import fn
|
from peewee import fn
|
||||||
|
from database import Polls as PollsModel, PollVotes as PollVotesModel
|
||||||
|
|
||||||
PollOptions = List[Tuple[str | None, str]]
|
PollOptions = List[Tuple[str | None, str]]
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ def datetime_to_discord_relative_time(dt: datetime) -> str:
|
||||||
|
|
||||||
def generate_bar(num: int, total: int, length: int = 10) -> str:
|
def generate_bar(num: int, total: int, length: int = 10) -> str:
|
||||||
"""Create a bar graph from a number and a total.
|
"""Create a bar graph from a number and a total.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
num : int
|
num : int
|
||||||
|
@ -77,7 +79,7 @@ def generate_poll_embed(
|
||||||
expires: datetime = None,
|
expires: datetime = None,
|
||||||
) -> Embed:
|
) -> Embed:
|
||||||
"""Create a poll embed from a title, options and votes.
|
"""Create a poll embed from a title, options and votes.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
title : str
|
title : str
|
||||||
|
@ -114,7 +116,7 @@ def generate_poll_embed(
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
|
||||||
def num_to_emoji(num: int) -> str:
|
def num_to_emoji(num: int) -> str: # pylint: disable=too-many-return-statements
|
||||||
match num:
|
match num:
|
||||||
case 0:
|
case 0:
|
||||||
return "0️⃣"
|
return "0️⃣"
|
||||||
|
@ -140,7 +142,7 @@ def num_to_emoji(num: int) -> str:
|
||||||
return "🔟"
|
return "🔟"
|
||||||
|
|
||||||
case _:
|
case _:
|
||||||
raise ValueError(f"Invalid number: `num` must be 0 <= num <= 10.")
|
raise ValueError("Invalid number: `num` must be 0 <= num <= 10.")
|
||||||
|
|
||||||
|
|
||||||
class Polls(Extension):
|
class Polls(Extension):
|
||||||
|
@ -150,7 +152,7 @@ class Polls(Extension):
|
||||||
@listen(events.Ready)
|
@listen(events.Ready)
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
await self.poll_expiry_check()
|
await self.poll_expiry_check()
|
||||||
self.poll_expiry_check.start()
|
self.poll_expiry_check.start() # pylint: disable=no-member
|
||||||
|
|
||||||
@slash_command(
|
@slash_command(
|
||||||
name="polls",
|
name="polls",
|
||||||
|
@ -178,7 +180,7 @@ class Polls(Extension):
|
||||||
required=False,
|
required=False,
|
||||||
opt_type=OptionTypes.BOOLEAN,
|
opt_type=OptionTypes.BOOLEAN,
|
||||||
)
|
)
|
||||||
async def create_poll(
|
async def create_poll( # pylint: disable=too-many-locals
|
||||||
self,
|
self,
|
||||||
ctx: InteractionContext,
|
ctx: InteractionContext,
|
||||||
*,
|
*,
|
||||||
|
@ -307,7 +309,7 @@ class Polls(Extension):
|
||||||
poll_entry.save()
|
poll_entry.save()
|
||||||
|
|
||||||
@listen(events.Button)
|
@listen(events.Button)
|
||||||
async def on_button(self, button: events.Button):
|
async def on_button(self, button: events.Button): #pylint: disable=too-many-branches,too-many-statements
|
||||||
ctx = button.context
|
ctx = button.context
|
||||||
|
|
||||||
# Ensure that the pressed button is a vote button.
|
# Ensure that the pressed button is a vote button.
|
||||||
|
@ -404,7 +406,7 @@ class Polls(Extension):
|
||||||
options: PollOptions = json.loads(poll_entry.options)
|
options: PollOptions = json.loads(poll_entry.options)
|
||||||
votes = len(options) * [0]
|
votes = len(options) * [0]
|
||||||
|
|
||||||
for i, vote in enumerate(votes_q):
|
for vote in votes_q:
|
||||||
votes[int(vote.option)] = vote.count
|
votes[int(vote.option)] = vote.count
|
||||||
|
|
||||||
embed = generate_poll_embed(
|
embed = generate_poll_embed(
|
||||||
|
@ -466,7 +468,7 @@ class Polls(Extension):
|
||||||
# Delete associated database entries, as they will no longer be updated.
|
# Delete associated database entries, as they will no longer be updated.
|
||||||
PollVotesModel.delete().where(PollVotesModel.poll_id == poll_entry.id).execute()
|
PollVotesModel.delete().where(PollVotesModel.poll_id == poll_entry.id).execute()
|
||||||
poll_entry.delete_instance()
|
poll_entry.delete_instance()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setup(client: Client):
|
def setup(client: Client):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from re import S
|
# pylint: disable=not-an-iterable
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
import logging
|
import logging
|
||||||
from naff import (
|
from naff import (
|
||||||
|
@ -11,7 +11,6 @@ from naff import (
|
||||||
InteractionContext,
|
InteractionContext,
|
||||||
Role,
|
Role,
|
||||||
Embed,
|
Embed,
|
||||||
EmbedField,
|
|
||||||
AutocompleteContext,
|
AutocompleteContext,
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
|
@ -21,7 +20,6 @@ from naff import (
|
||||||
Message,
|
Message,
|
||||||
)
|
)
|
||||||
from naff.api import events
|
from naff.api import events
|
||||||
from naff import components
|
|
||||||
from database import (
|
from database import (
|
||||||
SelfRoles as SelfRolesModel,
|
SelfRoles as SelfRolesModel,
|
||||||
SelfRoleGroups as SelfRoleGroupsModel,
|
SelfRoleGroups as SelfRoleGroupsModel,
|
||||||
|
@ -544,11 +542,11 @@ class SelfRoles(Extension):
|
||||||
async def role_group_regenerate(self, ctx: InteractionContext):
|
async def role_group_regenerate(self, ctx: InteractionContext):
|
||||||
await ctx.defer(ephemeral=True)
|
await ctx.defer(ephemeral=True)
|
||||||
msg: Message = ctx.target
|
msg: Message = ctx.target
|
||||||
|
|
||||||
if msg.author.id != self.client.user.id:
|
if msg.author.id != self.client.user.id:
|
||||||
await ctx.send("This message is not from the bot!", ephemeral=True)
|
await ctx.send("This message is not from the bot!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (
|
if (
|
||||||
len(msg.embeds) < 1
|
len(msg.embeds) < 1
|
||||||
or msg.embeds[0].title is None
|
or msg.embeds[0].title is None
|
||||||
|
@ -621,10 +619,6 @@ class SelfRoles(Extension):
|
||||||
await ctx.send("Role group message regenerated!", ephemeral=True)
|
await ctx.send("Role group message regenerated!", ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@slash_command(
|
@slash_command(
|
||||||
name="role",
|
name="role",
|
||||||
description="Manage your roles",
|
description="Manage your roles",
|
||||||
|
@ -648,7 +642,7 @@ class SelfRoles(Extension):
|
||||||
)
|
)
|
||||||
|
|
||||||
if role_q is None:
|
if role_q is None:
|
||||||
await ctx.send(f"Failed to retrieve self-role.", ephemeral=True)
|
await ctx.send("Failed to retrieve self-role.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
role = await ctx.guild.fetch_role(role)
|
role = await ctx.guild.fetch_role(role)
|
||||||
|
@ -732,7 +726,7 @@ class SelfRoles(Extension):
|
||||||
await ctx.defer(ephemeral=True)
|
await ctx.defer(ephemeral=True)
|
||||||
role = await ctx.guild.fetch_role(role)
|
role = await ctx.guild.fetch_role(role)
|
||||||
if role is None:
|
if role is None:
|
||||||
await ctx.send(f"Failed to retrieve role.", ephemeral=True)
|
await ctx.send("Failed to retrieve role.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if role not in ctx.author.roles:
|
if role not in ctx.author.roles:
|
||||||
|
|
Loading…
Reference in New Issue