Mobile Presence Interactions & Discord Py

Viewed 38

I have the following code. But the phone presence doesn't show up, it worked on old dpy and ipy version without errors but since I updated to dpy v2 and newest version of ipy, it doesn't work anymore.

class MyDiscordWebSocket(WebSocketClient):

    async def __identify(
            self, shard: Optional[List[Tuple[int]]] = None, presence: Optional[ClientPresence] = None
    ) -> None:
        self.__shard = shard
        self.__presence = presence
        payload: dict = {
            "op": OpCodeType.IDENTIFY,
            "d": {
                "token": self._http.token,
                "intents": self._intents.value,
                "properties": {
                    "$os": "Android",
                    "$browser": "Discord Android",
                    "$device": "Discord Android",
                },
            },
        }

        if isinstance(shard, List) and len(shard) >= 1:
            payload["d"]["shard"] = shard
        if isinstance(presence, ClientPresence):
            payload["d"]["presence"] = presence._json


bot = interactions.Client(token=TOKEN, presence=interactions.ClientPresence(
    activities=[interactions.PresenceActivity(name="Kryptia Citybuild", type=interactions.PresenceActivityType.GAME)]))
bot._websocket = WebSocketClient(token=TOKEN, intents=bot._intents)

What can I do?

1 Answers

You can install discord-ios

pip install -U git+https://github.com/dropout1337/Discord-iOS/

after installing it just import discord_ios before discord

import discord_ios

import discord
from discord.ext import commands

client = commands.Bot(...)

Its on here https://github.com/dropout1337/Discord-iOS

Related