Hello hello! 
I am trying to make requests to the Discord API, for example, getting information on a guild the user is in.
I can use the Python requests library, but this means no cooldown handling and all the cool interactions.py stuff.
import requests
def get_user_guild(guild_id: str):
url = "https://discordapp.com/api/v6/guilds/"+ guild_id +"/preview"
# we want a user token, because a bot token requires
# said bot to be in the mentioned guild :(
# not sure if that's nice! we don't want our users' tokens
headers = {'Authorization': TOKEN}
response = requests.get(url, headers=headers)
I know how to get guild info, but only if the bot is in it! This isn't very useful if the bot is only in a server or two.
from interactions import slash_command, slash_option, SlashContext, OptionType
@slash_command(name="get_server",
description="Get info on a server")
@slash_option(name="server_id",
description="ID of server to fetch",
required=True,
opt_type=OptionType.STRING)
async def cmd_get_user_guild(self, ctx: SlashContext, server_id: str):
# this requires the bot to be in the guild :(
guild = self.bot.get_guild(server_id)
await ctx.send("This guild is: "+ guild.name)
Does interactions.py allow a better way to do this? Thank you for reading my silly issue!