Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many improvements and changes #85

Open
wants to merge 4 commits into
base: rewrite-slash
Choose a base branch
from

Conversation

Soheab
Copy link
Contributor

@Soheab Soheab commented Aug 30, 2023

I have significantly improved the codebase with main changes being the following:

  • Change ctx to interaction like how its supposed to be
  • Make everything more typing friendly
  • Fix weird indents overal
  • Syncing:
    • Syncs globally now
    • Renamed DISCORD_GUILD_ID config var to OWNER_GUILD_ID and is actually used on all commands in cogs/admin.py and when syncing
  • Support for setting a custom status
  • Combined reload, load, unload, reloadall into one command with choices called extensions
  • Adding descriptions to all command arguments (I hope)
  • All encryption commands now support passing a file via the UI, same for /change avatar
  • Formatted all files using the black formatter with line-length set to 120
  • Moved amiadmin command to cogs/fun.py since that isn't supposed be owner-only
  • Fixed all checks to follow best practices
  • Removed unused code/functions
  • I probably forgot somethings

Nothing was tested

@AlexFlipnote
Copy link
Owner

Will review this when I get time, god damn this is a lot
image


# The Twitch username to use if activity type is "streaming"
# DISCORD_STATUS_URL = TTVUserName (Uncomment to use it)
# The URL to a Twtich/YouTube stream if DISCORD_ACTIVITY_TYPE is set to streaming.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twtich -> Twitch

location_name = interaction.guild.name if interaction.guild else "Private message"
print(
f"{location_name} > {interaction.user} > {interaction.command.qualified_name} (arguments: {vars(interaction.namespace)})"
)

@commands.Cog.listener()
async def on_ready(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing any of this in on_ready really sets a bad example. This needs to go in setup_hook.

)

await self.bot.change_presence(status=from_status_type[status_type], activity=activity)

global_synced = await self.bot.tree.sync()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Syncing app commands on startup is also not needed. This is especially bad in on_ready as it can be fired multiple times. Do not sync in on_ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants