mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Owner] Removed [p]join's accept_invite functionality
The endpoint that accept_invite makes use of is no longer safe due to Discord's antispam measures.
This commit is contained in:
parent
1577e7d854
commit
7820319a6a
@ -607,34 +607,12 @@ class Owner:
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def join(self, invite_url: discord.Invite=None):
|
async def join(self):
|
||||||
"""Joins new server"""
|
"""Shows Red's invite URL"""
|
||||||
if hasattr(self.bot.user, 'bot') and self.bot.user.bot is True:
|
if self.bot.user.bot:
|
||||||
# Check to ensure they're using updated discord.py
|
await self.bot.whisper("Invite URL: " + self.bot.oauth_url)
|
||||||
msg = ("I have a **BOT** tag, so I must be invited with an OAuth2"
|
else:
|
||||||
" link:\nFor more information: "
|
await self.bot.say("I'm not a bot account. I have no invite URL.")
|
||||||
"https://twentysix26.github.io/"
|
|
||||||
"Red-Docs/red_guide_bot_accounts/#bot-invites")
|
|
||||||
await self.bot.say(msg)
|
|
||||||
if hasattr(self.bot, 'oauth_url'):
|
|
||||||
await self.bot.whisper("Here's my OAUTH2 link:\n{}".format(
|
|
||||||
self.bot.oauth_url))
|
|
||||||
return
|
|
||||||
|
|
||||||
if invite_url is None:
|
|
||||||
await self.bot.say("I need a Discord Invite link for the "
|
|
||||||
"server you want me to join.")
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
await self.bot.accept_invite(invite_url)
|
|
||||||
await self.bot.say("Server joined.")
|
|
||||||
log.debug("We just joined {}".format(invite_url))
|
|
||||||
except discord.NotFound:
|
|
||||||
await self.bot.say("The invite was invalid or expired.")
|
|
||||||
except discord.HTTPException:
|
|
||||||
await self.bot.say("I wasn't able to accept the invite."
|
|
||||||
" Try again.")
|
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
|
|||||||
1
red.py
1
red.py
@ -69,6 +69,7 @@ class Bot(commands.Bot):
|
|||||||
self._shutdown_mode = None
|
self._shutdown_mode = None
|
||||||
self.logger = set_logger(self)
|
self.logger = set_logger(self)
|
||||||
self._last_exception = None
|
self._last_exception = None
|
||||||
|
self.oauth_url = ""
|
||||||
if 'self_bot' in kwargs:
|
if 'self_bot' in kwargs:
|
||||||
self.settings.self_bot = kwargs['self_bot']
|
self.settings.self_bot = kwargs['self_bot']
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user