質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Discord

Discordは、ゲーマー向けのボイスチャットアプリです。チャット・通話がブラウザ上で利用可能で、個人専用サーバーも開設できます。通話中でも音楽を流したり、PC画面を共有できるなど多機能な点が特徴です。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

1059閲覧

@bot.commandが機能していないです

Libe

総合スコア13

Discord

Discordは、ゲーマー向けのボイスチャットアプリです。チャット・通話がブラウザ上で利用可能で、個人専用サーバーも開設できます。通話中でも音楽を流したり、PC画面を共有できるなど多機能な点が特徴です。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2021/10/02 01:37

編集2021/10/02 04:34

出ているエラーコード

今の所なし

main.py

import discord import logging import abc import requests from discord.ext import tasks, commands import aiohttp from pprint import pprint import asyncio from datetime import datetime import json import typing from os import getenv import traceback discord_intents = discord.Intents.all() 問題はここだと思います -------------------------------------------------------------------------------------- bot = commands.Bot(command_prefix='.', description='A bot that greets the user back.') bot.remove_command("help") @bot.command() async def test(ctx): pass @bot.command() async def on_ready(): pass async def my_message(message): pass async def on_message(message): pass @bot.command() async def foo(ctx, arg): await ctx.send(arg) @bot.command() async def add(ctx, arg): await ctx.send(arg) @bot.command() async def _list(ctx, arg): await ctx.send(arg) ------------------------------------------------------------------------------------- class LibeClient(discord.Client): async def on_ready(self): print('--------------------------------------') print('Logged on as {0}!'.format(self.user)) print('Logged in as') print(self.user.name) print(self.user.id) print('ログインしました。') print('--------------------------------------') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.counter = 0 async def on_message(self, message): print('メッセージが来たよ→ {0.author}: {0.content}'.format(message)) if message.content.startswith('/id'): await message.channel.send('PaL_Libe') if message.content.startswith('logout'): await message.channel.send('ログアウトします。') await client.logout() if message.content == '!bot': await message.channel.send('```BOT discordバージョン起動中です。```') if message.content.startswith('Hi'): await message.channel.send(message.author.mention + 'hello') client = LibeClient() client.run('TOKEN')

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

itagagaki

2021/10/02 01:54

self.my_background_task.star これはどういう意味を持っているのですか?
Libe

2021/10/02 01:56

サイトを見ながらやってたので詳しくはわかりません(すみません)
itagagaki

2021/10/02 02:00

そのサイトでどういう解説がされているのかわかりませんが、問題はその行に間違いないので、何か間違っていないか確認してください。
Libe

2021/10/02 02:05

わかりました!
Libe

2021/10/02 02:09

ありがとうございます起動はしました!
Libe

2021/10/02 02:09

けど、@bot.commandはやっぱり機能しません
guest

回答1

0

自己解決

別のサイトで解決しました!

投稿2021/10/03 11:44

Libe

総合スコア13

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問