|
|
@ -707,33 +707,47 @@ class Application(PartialApplication): |
|
|
|
data = await self._state.http.reset_secret(self.id) |
|
|
|
return data['secret'] # type: ignore # Usually not there |
|
|
|
|
|
|
|
async def create_bot(self) -> ApplicationBot: |
|
|
|
async def fetch_bot(self) -> ApplicationBot: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|
Creates a bot attached to this application. |
|
|
|
Fetches the bot attached to this application. |
|
|
|
|
|
|
|
Raises |
|
|
|
------ |
|
|
|
Forbidden |
|
|
|
You do not have permissions to create bots. |
|
|
|
You do not have permissions to fetch the bot, |
|
|
|
or the application does not have a bot. |
|
|
|
HTTPException |
|
|
|
Creating the bot failed. |
|
|
|
Fetching the bot failed. |
|
|
|
|
|
|
|
Returns |
|
|
|
------- |
|
|
|
:class:`ApplicationBot` |
|
|
|
The newly created bot. |
|
|
|
The bot attached to this application. |
|
|
|
""" |
|
|
|
state = self._state |
|
|
|
data = await state.http.botify_app(self.id) |
|
|
|
|
|
|
|
data['public'] = self.public |
|
|
|
data['require_code_grant'] = self.require_code_grant |
|
|
|
data = await self._state.http.edit_bot(self.id, {}) |
|
|
|
data['public'] = self.public # type: ignore |
|
|
|
data['require_code_grant'] = self.require_code_grant # type: ignore |
|
|
|
|
|
|
|
bot = ApplicationBot(data=data, state=state, application=self) |
|
|
|
self.bot = bot |
|
|
|
self.bot = bot = ApplicationBot(data=data, state=self._state, application=self) |
|
|
|
return bot |
|
|
|
|
|
|
|
async def create_bot(self) -> None: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|
Creates a bot attached to this application. |
|
|
|
|
|
|
|
This does not fetch or cache the bot. |
|
|
|
|
|
|
|
Raises |
|
|
|
------ |
|
|
|
Forbidden |
|
|
|
You do not have permissions to create bots. |
|
|
|
HTTPException |
|
|
|
Creating the bot failed. |
|
|
|
""" |
|
|
|
await self._state.http.botify_app(self.id) |
|
|
|
|
|
|
|
|
|
|
|
class InteractionApplication(Hashable): |
|
|
|
"""Represents a very partial Application received in interaction contexts. |
|
|
|