Closed sweep-ai[bot] closed 10 months ago
tests/test_main.py
. β
Run `tests/test_main.py` through the sandbox.
You didn't seperate them into cogs? Below is an example of a cog:
class Greetings(commands.Cog):
def __init__(self, bot):
self.bot = bot
self._last_member = None
@commands.Cog.listener()
async def on_member_join(self, member):
channel = member.guild.system_channel
if channel is not None:
await channel.send(f'Welcome {member.mention}.')
@commands.command()
async def hello(self, ctx, *, member: nextcord.Member = None):
"""Says hello"""
member = member or ctx.author
if self._last_member is None or self._last_member.id != member.id:
await ctx.send(f'Hello {member.name}~')
else:
await ctx.send(f'Hello {member.name}... This feels familiar.')
self._last_member = member
And then in main.py: bot.add_cog(Greetings(bot))
I wasn't able to make changes. This could be due to an unclear request or a bug in my code. As a reminder, comments on a file only modify that file. Comments on a PR (at the bottom of the "conversation" tab) can modify the entire PR. Please try again or contact us on Discord
PR Feedback (click)
Description
This pull request refactors the
main.py
file into separate cogs. It also includes changes to update user nicknames with their total value and RAP, and to delete user items during a duel.Summary
main.py
into separate cogsupdate_user_nicknames
function to update user nicknames with total value and RAPdelete_user_items
function to delete user items during a duelFixes #3.
π Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py
!π‘ To get Sweep to edit this pull request, you can: