--- /dev/null
+from aptbot.bot import Message, Commands, Bot
+import os
+import tools.smart_privmsg
+import requests
+import logging
+
+logger = logging.getLogger(__name__)
+
+PERMISSION = 99
+PREFIX = "?"
+DESCRIPTION = ""
+USER_COOLDOWN = 600
+GLOBAL_COOLDOWN = 5
+
+DISCORD_API = os.getenv("DISCORD_API")
+
+PEKS_CHANNEL_ID = 806590801311301652
+
+
+def main(bot: Bot, message: Message):
+ try:
+ response = requests.post(
+ f"https://discord.com/api/v10/channels/{PEKS_CHANNEL_ID}/invites",
+ headers={
+ "Authorization": f"Bot {DISCORD_API}",
+ "Content-Type": "application/json",
+ },
+ json={
+ "max_age": 300,
+ "max_uses": 1,
+ "unique": True,
+ },
+ )
+ except Exception as e:
+ logger.exception(e)
+ msg = "Sorry, I'm unable to create a discord link at this time. \
+ Please contact IHasPeks#6552 or Yorugo#4966 \
+ on discord to send you an invite."
+ tools.smart_privmsg.send(bot, message, msg, reply=message.tags["id"])
+ return
+
+ if response.status_code != 200:
+ logger.critical(
+ f"Unable to create a discord link. \
+ Status code: {response.status_code}. With content: {response.content}"
+ )
+ msg = "Sorry, I'm unable to create a discord link at this time. \
+ Please contact IHasPeks#6552 or Yorugo#4966 \
+ on discord to send you an invite."
+ tools.smart_privmsg.send(bot, message, msg, reply=message.tags["id"])
+ return
+ msg = f"https://discord.gg/{response.json()['code']} don't forget to verify\
+ yourselves on #rules channel, enjoy your time! Discordblob"
+
+ tools.smart_privmsg.send(bot, message, msg, reply=message.tags["id"])