我试图让我的Discord机器人说些什么,并在创建频道时等待消息,等等,但是我不确定该怎么做,这是我现在正在处理的代码:>
$rows = $someRepository->getRows();
foreach ($rows as $row) {
try {
$db->beginTransaction(); //simple begin transaction in db
//do some handling of data
// Maybe load some other entities and update those
// ...
$db->commit();
} catch (Throwable $t) {
//log error
//clear entity cache
$db->rollback(); //simple rollback in db
}
}
答案 0 :(得分:0)
@client.event
async def on_guild_channel_create(channel):
if channel.category: #if the channel created is in a category
#send something
await channel.send("Something")
答案 1 :(得分:0)
我不确定我是否正确理解了您的问题,但是我会这样做。
if defined?(PhusionPassenger)
PhusionPassenger.advertised_concurrency_level = 0
end
您可以在official Discord.py Documentation的Event Reference上找到更多选项。例如,您可以将on_guild_channel_create更改为on_guild_channel_update,这样您的漫游器就会在每次您更新名称,主题或权限时发送一条消息。