【发布时间】:2018-12-09 06:38:30
【问题描述】:
这个问题可能很复杂,我的大脑无法很好地解释它,所以请用这个蹩脚的解释来解释,我的问题,当你触发一个命令时,例如 .start 它将开始让我们说一个基于文本的游戏,当然您将拥有能够实际玩游戏的命令,但我担心人们仍然可以触发游戏内命令而无需启动游戏。
if message.content.startswith("/play"): #Here is the play command where you execute the game to start
await client.send_message(message.channel, "Welcome to the game!")
if message.content.startswith("/examine):
await client.send_message(message.channel, "You examined the rock and well, got a rock!") #In-Game commands/movements
我的意思是,有没有办法只有在游戏本身被激活时才能使用游戏中的命令? 附加问题:您将如何存储用户的信息,例如基本上保存游戏(您实际上不需要回答这个问题,因为我想自己学习,但任何提示都会很棒!)
【问题讨论】:
-
游戏是按玩家级别还是按频道级别进行的?您可以看到一个如何将数据持久保存在文件中的示例in this question
-
它的每个玩家。我在问题中所说的担心是您仍然可以在游戏之外触发命令。
标签: python python-3.x discord discord.py