所以,我正在做一个命令,把一个消息发布到一个特定的渠道,我需要做它,所以付款选项,如果说买卖,而不是什么时候选择广告。总之要这么做?(使用disnake)
try:
await asyncio.sleep(2)
await channel2.send(f"Please send the Post type `Advertisement` , `Selling` , `Buying` {inter.author.mention}")
msg = await self.bot.wait_for('message', check=check, timeout=120)
PType = str(msg.content)
await channel2.send("Please provide the name of the post:")
msg2 = await self.bot.wait_for('message', check=check, timeout=120)
Pname = str(msg2.content)
await channel2.send("Please provide the body of the post:")
msg3 = await self.bot.wait_for('message', check=check, timeout=120)
Body = str(msg3.content)
if "Advertisement" not in msg.content.lower():
await channel2.send("Please Provide payment option")
msg2 = await self.bot.wait_for("message", check=check, timeout=120)
Payment = str(msg2.content)
await channel2.send("Please Provide payment amount")
msg2 = await self.bot.wait_for("message", check=check, timeout=120)
Amount = str(msg2.content)
await channel2.send("Please wait for moderation to approve your message.")
reportchannel = disnake.utils.get(guild.channels, id=920358352876355664)
rem = disnake.Embed(title=f"New post created by {user.display_name}/{user.id}", description="-")
rem.add_field(name=f"Post Type: {PType}", value=f"-")
rem.add_field(name=f"{Pname}", value=f"{Body}")
if "Advertisement" not in msg.content.lower():
rem.add_field(name="Payment Type:", value=f"{Payment}")
rem.add_field(name="Payment:", value=f"{Amount}")
await reportchannel.send(embed=rem)
await asyncio.sleep(15)
await channel2.delete()
except asyncio.TimeoutError:
await channel2.delete()
await user.send("Your channel was deleted due to a timeout. The time is limited to 120 seconds.")
```发布于 2021-12-14 18:35:52
下面是如何查找字符串中的单词:
word = "example"
if word in example_string:
# do what you want herehttps://stackoverflow.com/questions/70353383
复制相似问题