-
Notifications
You must be signed in to change notification settings - Fork 187
feat: Warn if people try to run d.py alongside interactions #1440
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
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## stable #1440 +/- ##
==========================================
- Coverage 60.27% 60.19% -0.09%
==========================================
Files 139 139
Lines 14705 14708 +3
==========================================
- Hits 8863 8853 -10
- Misses 5842 5855 +13
☔ View full report in Codecov by Sentry. |
|
Alternate idea. Move this check to client's sanity check method |
16b806a to
49edc83
Compare
|
Considered, implemented, then reverted upon further consideration 😂 Take this thread as an example: https://discord.com/channels/789032594456576001/1110958056327626753/1110959282213621860 import discord
from discord import app_commands
from discord.ext import commands
from interactions import slash_command, SlashContext, Permissions, slash_default_member_permission, Extension
...
bot = commands.Bot (command_prefix="*", intents = discord.Intents.all())
slash = slash_command(bot, sync_commands=True)
command_count = 0
staff = Permissions.MANAGE_ROLES
class Player(commands.Cog):
def __init__(self, bot):
self.bot = bot
@slash_command(name="X", description="X")
@slash_default_member_permission(staff)
async def hello(self, ctx: SlashContext):
await ctx.send(f"Hey {ctx.author.mention}! Test")
bot.add_cog(Player(bot))
@bot.event
async def on_ready():
print(f"Bot conectado como {bot.user.name}")
await slash.sync_all_commands()
token = os.getenv('TOKEN')
bot.run(token)They're using interactions decorators on a d.py client. They're still going to run into issues, but they won't ever call sanity check. |
|
Id argue that's extreme user error at that point. But fair point, then I have one more suggestion. Put it in the root init |
|
That was my initial plan, but it felt weird. |
|
It's standard practice for checks like this. Const feels weird, imo |
|
Understandable. I'll move it to init |
|
oh fml. this targetted stable... dammit sil, i trusted you |
* feat: Warn if people try to run d.py alongside interactions * refactor: Move d.py check to __init__.py
|
Ooops. I blame the fact that stable and unstable were at the same place when I made the PR. |
Pull Request Type
Description
We frequently recieve support requests where provided code snippits start with the line "import discord" and inevitably don't work.
Due to the nature of humans generally importing stuff alphabetically, we can do runtime check for this import, and yell at them.
Changes
Related Issues
Test Scenarios
Python Compatibility
3.10.x3.11.xChecklist
pre-commitcode linter over all edited files