我正在使用一个使用python和discord.py的discord机器人。我在discord上启用了TTS,甚至当我使用标记tts=False时,只要我让机器人向通道发送消息,它就会使用tts读出消息。我不知道如何禁用它,因为文档中只简单地说要使用tts=False,这就是我正在做的。因此,在下面的示例中,当输入.ping时,tts读出"Bot says My ping is 10ms“,并向通道发送相同的消息,我希望它只向通道发送消息,而不是读出它。 import discord
from discord.ext import commands
client = command
我有一个数组,我想用discord.py在for循环中发送少量消息。我试图使用on_ready()命令,但只发送第一条消息就有问题。我对异步和不和谐的机器人都很陌生。这里一定有更简单的解决办法..。
client = discord.Client()
links = []
for x in y:
# do some things
links.append(stuff)
@client.event
async def on_ready():
channel = client.get_channel(12345678910)
for link in links:
import discord
import os
from keep_alive import keep_alive
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
#!test1
if me
我试着用discord.py做了一个机器人
bot = commands.Bot(command_prefix='$', description="This is a test bot")
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
@bot.command(name='ping')
async def ping(ctx):
await ctx.send("pong
我正在尝试制造一个机器人,它可以在每个服务器中发送消息到允许它发送消息的通道。
下面是代码:
@client.event
async def on_ready(): #executes when ran
print("Ready!")
while 1 == 1: #loops code below
for i in client.guilds: #going to all servers
for j in i.channels: #going to all channel in server
我正在开发一个python中的不和谐机器人,它可以在每天的特定时间在服务器上发送预定的消息,以及其他功能。在实现计划的消息之后,机器人命令不再工作-因此用户不能使用任何命令,但计划的消息可以工作。
我设置了机器人,以便它在12:00,19:00,21:00,22:00,23:00UTC发送消息。唯一的问题是诸如";help“之类的命令现在不起作用。
import discord
import datetime
import asyncio
from discord.ext import commands
from discord.utils import get
client = c
我试图让我的机器人在用户对消息做出反应之后给出一个角色,但是每次我收到相同的错误时。我不明白这个错误意味着什么。有人能帮忙吗?这是代码:
import discord
from discord.ext import commands
from discord import Member
from discord.ext.commands import has_permissions
from discord.ext import tasks
#sets the command prefix
Client = commands.Bot(command_prefix = "!"
import discord
import os
import pytz
import datetime
import asyncio
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def dm(ctx):
print('Message from {0.author}: {0.content}'.format(message))
if
我有一个discord机器人,它基于web抓取应用程序每隔一段时间发送一条消息(这里不会显示,因为它有500行长,其他人可能会与它竞争某些东西),这是发送消息的代码: import discord
import time
import asyncio
#the reason it is in while true is so it sends more frequently than once every 30 minutes for testing
while True:
bot = discord.Client()
@bot.event
async def