Improve Brother messages
This commit is contained in:
parent
0699c0f474
commit
a072ea3dd0
|
@ -1 +1,2 @@
|
||||||
discord_token: insert_token_here
|
discord_token: insert_token_here
|
||||||
|
guild: insert_guild_id_here
|
||||||
|
|
|
@ -251,25 +251,36 @@ async def on_ready():
|
||||||
philia, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True)
|
philia, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not config.left_channel:
|
if not config.brother_channel:
|
||||||
channel: TextChannel = await secret_category.create_text_channel("left")
|
channel: TextChannel = await secret_category.create_text_channel("doliprane")
|
||||||
config.left_channel = channel.id
|
config.brother_channel = channel.id
|
||||||
config.save()
|
config.save()
|
||||||
|
|
||||||
left_channel: TextChannel = await guild.fetch_channel(config.left_channel)
|
brother_channel: TextChannel = await guild.fetch_channel(config.brother_channel)
|
||||||
if not left_channel:
|
if not brother_channel:
|
||||||
config.left_channel = None
|
config.brother_channel = None
|
||||||
return await on_ready()
|
return await on_ready()
|
||||||
|
|
||||||
await left_channel.edit(name="left", category=secret_category, position=1,
|
await brother_channel.edit(name="doliprane", category=secret_category, position=1,
|
||||||
topic="Des voix dans la tête ...")
|
topic="Des voix dans la tête ...")
|
||||||
await left_channel.set_permissions(
|
await brother_channel.set_permissions(
|
||||||
guild.default_role, overwrite=PermissionOverwrite(read_message_history=False, read_messages=False)
|
guild.default_role, overwrite=PermissionOverwrite(read_message_history=False, read_messages=False)
|
||||||
)
|
)
|
||||||
await left_channel.set_permissions(
|
await brother_channel.set_permissions(
|
||||||
philia, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True)
|
philia, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
brother_channel_webhook = None
|
||||||
|
if config.brother_channel_webhook is not None:
|
||||||
|
try:
|
||||||
|
brother_channel_webhook = await bot.fetch_webhook(config.brother_channel_webhook)
|
||||||
|
except disnake.HTTPException | disnake.NotFound | disnake.Forbidden:
|
||||||
|
pass
|
||||||
|
if brother_channel_webhook is None:
|
||||||
|
brother_channel_webhook = await brother_channel.create_webhook(name="???")
|
||||||
|
config.brother_channel_webhook = brother_channel_webhook.id
|
||||||
|
config.save()
|
||||||
|
|
||||||
if not config.backdoor_channel:
|
if not config.backdoor_channel:
|
||||||
channel: TextChannel = await secret_category.create_text_channel("backdoor")
|
channel: TextChannel = await secret_category.create_text_channel("backdoor")
|
||||||
config.backdoor_channel = channel.id
|
config.backdoor_channel = channel.id
|
||||||
|
@ -293,13 +304,21 @@ async def on_ready():
|
||||||
config.save()
|
config.save()
|
||||||
|
|
||||||
|
|
||||||
@bot.command()
|
@bot.command(help="Envoyer un message en tant qu'Orochi.")
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
async def send(ctx: commands.Context, *, message: str):
|
async def send(ctx: commands.Context, *, message: str):
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
await ctx.send(message)
|
await ctx.send(message)
|
||||||
|
|
||||||
|
|
||||||
|
@bot.command(help="Envoyer un message à Philia par la pensée en tant que Brother.")
|
||||||
|
@commands.has_permissions(administrator=True)
|
||||||
|
async def brother(ctx: commands.Context, *, message: str):
|
||||||
|
webhook = await bot.fetch_webhook(bot.config.brother_channel_webhook)
|
||||||
|
await webhook.send(message)
|
||||||
|
await ctx.message.reply("Message envoyé.")
|
||||||
|
|
||||||
|
|
||||||
@bot.command()
|
@bot.command()
|
||||||
async def vote(ctx: commands.Context):
|
async def vote(ctx: commands.Context):
|
||||||
view = Confirm()
|
view = Confirm()
|
||||||
|
|
|
@ -25,7 +25,8 @@ class Config:
|
||||||
vote_channels: dict[str, int] = field(default_factory=dict)
|
vote_channels: dict[str, int] = field(default_factory=dict)
|
||||||
backdoor_channel: int = None
|
backdoor_channel: int = None
|
||||||
telepathy_channel: int = None
|
telepathy_channel: int = None
|
||||||
left_channel: int = None
|
brother_channel: int = None
|
||||||
|
brother_channel_webhook: int = None
|
||||||
player_roles: dict[str, int] = field(default_factory=dict)
|
player_roles: dict[str, int] = field(default_factory=dict)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue