main.py
import discord
import os
from kmf import playkmf
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('-='):
if message.content == '-= playkmf':
await playkmf(message)
else :
await message.channel.send("type -=help for help")
client.run(os.getenv('TOKEN'))
kmf.py
async def playkmf(message) :
allMembers = message.guild.members
for x in allMembers:
print(x.name)
await message.channel.send('KMF started')
output when i type "-= playkmf" in the console
We have logged in as JujuGames#6518
JujuGames
There are 5 member in the discord server. The output is showing only 1 member.