'403 Forbidden when trying to change multiple bots statuses. (discord py)

Whenever i try to change a bot's status using requests (python) in discord i get 403 Forbidden.
(Note: im trying to change multiple bots statuses so i can't use the normal client.change_presence function)
Code:

import discord, json
from discord.ext import commands
from discord.ext.commands import Bot
import threading
from threading import Thread
from libs import (
  core
)
from libs.core import *


class Misc(commands.Cog, name="Miscellanous Commands"):
  def __init__(self, bot):
    self.bot = bot
    self.tokens = core.tokens

  @commands.command(name="status", description="Available statuses are: online, dnd (do not disturb), offline, idle")
  async def status(self, ctx, *, args):
    """Changes the bots statuses"""
    args = args.lower()
    for token in self.tokens:
      if args == "on" or args == "online":
        try:
          result = requests.patch("https://discord.com/api/v8/users/@me/settings", headers=core.mainHeaders(token), data=json.dumps({"status":"online"}))
        except:
          pass
            
      if args == "dnd" or args == "do not disturb":
        try:
          result = requests.patch("https://discord.com/api/v8/users/@me/settings", headers=core.mainHeaders(token), data=json.dumps({"status":"dnd"}))
        except:
          pass

      if args == "idle":
        try:
          result = requests.patch("https://discord.com/api/v8/users/@me/settings", headers=core.mainHeaders(token), data=json.dumps({"status":"idle"}))
        except:
          pass

      if args == "off" or args == "offline":
        try:
          result = requests.patch("https://discord.com/api/v8/users/@me/settings", headers=core.mainHeaders(token), data=json.dumps({"status":"invisible"}))
        except:
          pass
      print(result)

def setup(bot):
  bot.add_cog(Misc(bot))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source