Patches

Contains the code required to patch out the fact that Bot class ignores messages from other bots.

This should be used if you have a target bot that uses the ext.commands.Bot system, as otherwise it’s commands will ignore messages from the tester bot.

Usage

Simply put the below code into your main bot and then when testing, the bot will no longer ignore other bots!

1
2
3
4
5
6
bot = commands.Bot(command_prefix='$')

# Do anything you want for this if, be it env vars, command line args, or the likes.
if sys.argv[2] == "TESTING":
    from distest.patches import patch_target
    bot = patch_target(bot)

Docs

distest.patches.patch_target(bot)[source]

Patches the target bot. It changes the process_commands function to remove the check if the received message author is a bot or not.

Parameters

bot (discord.ext.commands.Bot) –

Returns

The patched bot.