I have this code where I want it so that when I say p!serverlist
it would print out the servers that it's in. I don't know how to "append" the servers in my variable a.
if message.content.startswith('p!serverlist'):
a = ''
e = 0
await message.channel.send('**Servers that I am in**')
for guild in client.guilds:
await a.append(f' `{guild.name}` ')
e += 1
await message.channel.send(a)
await message.channel.send('**I am in ' + str(e) + ' servers!**')```
You don't .append
it. You just use the +=
operator.
a += f' {guild.name} '
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.