Checking if a user is mobiile

client.on('messageCreate', async (message) => {
    // Check if the user is online and has presence data
    if (message.author.presence && message.author.presence.clientStatus) {
        const userIsOnMobile = message.author.presence.clientStatus.mobile;

        if (userIsOnMobile) {
            message.channel.send(`${message.author.username} is using Discord on mobile.`);
            console.log('using')
        } else {
            message.channel.send(`${message.author.username} is not using Discord on mobile.`);
        }
    } else {
        message.channel.send(`${message.author.username} is not currently online.`);
    }


Ngl I tryed using gpt because I doubt anyone has ever gotten code for this lol
Was this page helpful?