88:py:class:`DiscordCliInterface` is a subclass of :py:class:`DiscordInteractiveInterface` and simply contains logic to
99start the bot when it wakes up
1010"""
11+
1112import discord
1213
1314from .TestInterface import TestResult , Test , TestInterface
2425
2526intents = discord .Intents .default ()
2627intents .members = True
28+ intents .presences = True
2729
2830
2931class DiscordBot (discord .Client ):
@@ -50,18 +52,21 @@ def _find_target(self, server: discord.Guild) -> discord.Member:
5052 for member in server .members :
5153 if self ._target_name == member .id :
5254 if member .status == discord .Status .offline :
53- print ("Looks like the target bot is on the server but offline, you might want to check on that!" )
55+ print ("Looks like the target bot is on the server but offline, "
56+ "you might want to check on that!" )
5457 return member
58+ print ("Looks like I can't see any server members! You may need to enable the privileged gateway intent, see "
59+ "here for how to do so: https://discordpy.readthedocs.io/en/latest/intents.html" )
5560 raise KeyError ("Could not find member with id {}" .format (self ._target_name ))
5661
5762 async def run_test (
58- self , test : Test , channel : discord .TextChannel , stop_error = False
63+ self , test : Test , channel : discord .TextChannel , stop_error = False
5964 ) -> TestResult :
6065 """ Run a single test in a given channel.
6166
6267 Updates the test with the result and returns it
6368
64- :param Test test: The :py:class:`Test` that is to be run
69+ :param Test test: The :py:class:`Test <distest.TestInterface.Test> ` that is to be run
6570 :param discord.TextChannel channel: The
6671 :param stop_error: Weather or not to stop the program on error. Not currently in use.
6772 :return: Result of the test
@@ -128,9 +133,9 @@ async def _build_stats(self, tests) -> str:
128133 if test .result is TestResult .UNRUN :
129134 response += "⚫ Not run\n "
130135 elif test .result is TestResult .SUCCESS :
131- response += "✔️ Passed\n "
136+ response += "✓ Passed\n "
132137 elif test .result is TestResult .FAILED :
133- response += "❌ Failed\n "
138+ response += "✘ Failed\n "
134139 self .failure = True
135140 response += "```\n "
136141 return response
@@ -217,7 +222,6 @@ def __init__(self, target_id, collector, test, channel_id, stats, timeout):
217222 self ._stats = stats
218223 self ._channel = None
219224
220- #
221225 def run (self , token ) -> int :
222226 """ Override of the default run() that returns failure state after completion.
223227 Allows the failure to cascade back up until it is processed into an exit code by
0 commit comments