私はこれについて助けが必要です:
import discord
from discord.ext import commands
from discord.voice_client import VoiceClient
bot = commands.Bot(";")
@bot.command(pass_context=True)
async def sendm(member, sv, ch, *, msg):
serverd = member.server.id("{0}".format(sv))
channel = member.server.get_channel("{0}".format(ch))
await bot.send_message(serverd, channel, msg)
bot.run("TOKEN")
エラーリスト:
私が不和サーバーに入力したもの:
;sendm 411576459077877783 general test
Raspberry Pi3を使用したホスティング
コンテキストを渡します。つまり、最初の引数は。Context
ではなくオブジェクトになりますMember
。メッセージにチャネルIDが含まれている限り、他に何も必要ありません。
@bot.command()
async def sendm(ch, *, msg):
channel = bot.get_channel(ch)
if channel:
await bot.send_message(channel, msg)
else:
await bot.say('I can't find that channel')
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加