示例#1
0
        await ctx.send(" 누구를 언밴할 거냐고, 이 쓸모없는 쓰레기야! ")


@clear.error
async def clear_error(ctx, error):
    if isinstance(error, commands.MissingAnyRole):
        await ctx.send("{} 넌 권한이 없다, 이 쓸모없는 쓰레기야! ".format(ctx.message.author))


@mute.error
async def mute_error(ctx, error):
    if isinstance(error, commands.MissingAnyRole):
        await ctx.send("{} 넌 권한이 없다, 이 느끼한 느림보야! ".format(ctx.message.author))
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send(" 누구를 뮤트할 건지 쓰라고, 이 풋풋한 풋내기야! ")
    if isinstance(error, commands.BadArgument):
        await ctx.send(" 누구를 뮤트할 거냐고, 이 멍청한 멍청아! ")


@unmute.error
async def unmute_error(ctx, error):
    if isinstance(error, commands.MissingAnyRole):
        await ctx.send("{} 넌 권한이 없다, 이 느끼한 느림보야! ".format(ctx.message.author))
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send(" 누구를 언뮤트할 건지 쓰라고, 이 고환 없는 고자야! ")
    if isinstance(error, commands.BadArgument):
        await ctx.send(" 누구를 언뮤트할 거냐고, 이 거대한 거위야! ")


Bot.run(os.environ['token'])
示例#2
0
    Base.ConfiguredCog.logger.debug(
        f'AutoDrawingPrompt Cog check resulted in: {enable_cog}.')
    if enable_cog or enable_cog is None:
        Base.ConfiguredCog.logger.debug('Adding AutoDrawingPrompt Cog.')
        discord_bot.add_cog(AutoDrawingPrompt(discord_bot))
    else:
        Base.ConfiguredCog.logger.debug('Skipping AutoDrawingPrompt Cog.')

    enable_cog = Base.is_cog_enabled('cookieHunt', Base.ConfiguredCog.config)
    Base.ConfiguredCog.logger.debug(
        f'CookieHunt Cog check resulted in: {enable_cog}.')
    if enable_cog or enable_cog is None:
        Base.ConfiguredCog.logger.debug('Adding CookieHunt Cog.')
        discord_bot.add_cog(CookieHuntCog(discord_bot))
    else:
        Base.ConfiguredCog.logger.debug('Skipping CookieHunt Cog.')

    enable_cog = Base.is_cog_enabled('diceRoller', Base.ConfiguredCog.config)
    Base.ConfiguredCog.logger.debug(
        f'diceRoller Cog check resulted in: {enable_cog}.')
    if enable_cog or enable_cog is None:
        Base.ConfiguredCog.logger.debug('Adding DiceRoller Cog.')
        discord_bot.add_cog(DiceRollerCog(discord_bot))
    else:
        Base.ConfiguredCog.logger.debug('Skipping DiceRoller Cog.')

    # Run the bot
    Base.ConfiguredCog.logger.warning(
        'Launching Manageable with the specified bot token.')
    discord_bot.run(Base.ConfiguredCog.config['token'])
示例#3
0
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <https://www.gnu.org/licenses/>.

import logging

from discord import Intents
from discord.ext.commands.bot import Bot, when_mentioned

from os import environ

if __name__ == '__main__':
    logging.basicConfig(format='[%(levelname)s] %(name)s: %(message)s', level=logging.INFO)
    
    opts = Intents(messages=True, guilds=True)
    bot = Bot(when_mentioned, case_insensitive=True, intents=opts)
    bot.logger = logging.getLogger()

    bot.load_extension('cogs')

    try:
        bot.run(environ['DISCORD_TOKEN'])
    except KeyError:
        print('Token for accessing Discord API was not given')
示例#4
0
bot = Bot("m!")

quote_wall_id = 692999924349927514
webhook_url = getenv("WEBHOOK_URL")
bot_token = getenv("BOT_TOKEN")


@bot.event
async def on_ready():
    print("I'm awake now")


@bot.event
async def on_message(message: Message):
    async with aiohttp.ClientSession() as session:
        target_webhook = Webhook.from_url(webhook_url,
                                          adapter=AsyncWebhookAdapter(session))
        if message.channel.id == quote_wall_id:
            await target_webhook.send(
                message.content,
                username=message.author.display_name,
                avatar_url=message.author.avatar_url,
                files=[
                    await file.to_file(spoiler=file.is_spoiler())
                    for file in message.attachments
                ])


bot.run(bot_token)