コード例 #1
0
ファイル: config.py プロジェクト: bradykelly/Solaris
async def gateway__goodbyebottext(bot, channel, value):
    """The goodbye message text for bots
    The message sent to the goodbye channel (if set) when a bot leaves the server. This message can be up to 500 characters in length. If no message is set, a default will be used instead. The message can be reset at any time by passing no arguments to the command below."""
    if value is None:
        await bot.db.execute(
            "UPDATE gateway SET GoodbyeBotText = NULL WHERE GuildID = ?",
            channel.guild.id)
        await channel.send(
            f"{bot.tick} The goodbye bot message text has been reset.")
        lc = await retrieve.log_channel(bot, channel.guild)
        await lc.send(
            f"{bot.info} The goodbye bot message text has been reset.")
    elif not isinstance(value, str):
        await channel.send(
            f"{bot.cross} The goodbye bot message text must be a string.")
    elif len(value) > MAX_WGBOTTEXT_LEN:
        await channel.send(
            f"{bot.cross} The goodbye bot message text must be no longer than {MAX_WGBOTTEXT_LEN:,} characters in length."
        )
    elif not string.text_is_formattible(value):
        await channel.send(
            f"{bot.cross} The given message is not formattible (probably unclosed brace)."
        )
    else:
        await bot.db.execute(
            "UPDATE gateway SET GoodbyeBotText = ? WHERE GuildID = ?", value,
            channel.guild.id)
        await channel.send(
            f"{bot.tick} The goodbye bot message text has been set.")
        lc = await retrieve.log_channel(bot, channel.guild)
        await lc.send(
            f"{bot.info} The goodbye bot message text has been set to the following: {value}"
        )
コード例 #2
0
ファイル: config.py プロジェクト: bradykelly/Solaris
async def gateway__gatetext(bot, channel, value):
    """The gate message text
    The message displayed in the gate message. The message can be up to 250 characters in length, and should **not** contain the server rules. If no message is set, a default will be used instead. The message can be reset at any time by passing no arguments to the command below."""
    if value is None:
        await bot.db.execute(
            "UPDATE gateway SET GateText = NULL WHERE GuildID = ?",
            channel.guild.id)
        await channel.send(
            f"{bot.tick} The gate message text has been reset. The module needs to be restarted for these changes to take effect."
        )
        lc = await retrieve.log_channel(bot, channel.guild)
        await lc.send(f"{bot.info} The gate message text has been reset.")
    elif not isinstance(value, str):
        await channel.send(
            f"{bot.cross} The gate message text must be a string.")
    elif len(value) > MAX_GATETEXT_LEN:
        await channel.send(
            f"{bot.cross} The gate message text must be no longer than {MAX_GATETEXT_LEN:,} characters in length."
        )
    elif not string.text_is_formattible(value):
        await channel.send(
            f"{bot.cross} The given message is not formattible (probably unclosed brace)."
        )
    else:
        await bot.db.execute(
            "UPDATE gateway SET GateText = ? WHERE GuildID = ?", value,
            channel.guild.id)
        await channel.send(
            f"{bot.tick} The gate message text has been set. The module needs to be restarted for these changes to take effect."
        )
        lc = await retrieve.log_channel(bot, channel.guild)
        await lc.send(
            f"{bot.info} The gate message text has been set to the following: {value}"
        )