2021年4月25日星期日

I am currently learning to make a discord bot. I want to create a switch statement

import os  import discord    client = discord.Client()    @client.event  async def on_ready():    print('we have logged in as {0.user}'.format(client))    @client.event  async def on_message(message):    if message.author == client.user:       return      if message.content.startswith('$Hello'):      await message.channel.send('Hello! write "$Help" to find more about the Noriku bot ')        if message.content.startswith('$Help'):      await message.channel.send('Hi again! The noriku bot is still in beta stages...the only 2 commands are $Hello and $Help')        client.run(os.getenv('token'))  

What I am trying to do is to make switch statement since many professionals say that is better than making if statements

https://stackoverflow.com/questions/67255804/i-am-currently-learning-to-make-a-discord-bot-i-want-to-create-a-switch-stateme April 26, 2021 at 12:36AM

没有评论:

发表评论