discord.py(v1.0.0 rewrite版)

$helloと打つと、メンバーの一覧を送信する


import discord

TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # トークンキー

client = discord.Client()


@client.event
async def on_message(message):
	if message.author == client.user:
		return

	if message.content.startswith('$hello'):

		menber_list = []

		for a in client.get_all_members():
			menber_list.append(a.name)

		await message.channel.send(menber_list)

$helloと打つと、チャンネルの一覧を送信する


import discord

TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # トークンキー

client = discord.Client()


@client.event
async def on_message(message):
	if message.author == client.user:
		return

	if message.content.startswith('$hello'):

		menber_list = []

		for a in client.get_all_members():
			menber_list.append(a.name)

		await message.channel.send(menber_list)

discord_py

Posted by iser