'Discord.py | How to show on how many servers your bot is connected
I am trying to get it to show with the rest of the commands but it always gives a error about 'game' not being defined.
import discord
import os
from discord.ext import commands, tasks
from itertools import cycle
from keep_alive import keep_alive
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=os.getenv('prefix'), intents=intents)
status = cycle(['nc.help', 'nc.streamers', 'nc.form'])
client.remove_command('help')
@client.event
async def on_ready():
change_status.start()
print(f"Sucessfully logged in as {client.user}")
@tasks.loop(seconds=10)
async def change_status():
await client.change_presence(game=discord.Game(name="on " + str(len(client.guilds)) + " Servers.", type=0))
Solution 1:[1]
change_presence() does not have a game parameter replace it with activity
await client.change_presence(activity=discord.Game(name="on " + str(len(client.guilds)) + " Servers.", type=0))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jawad |
