so I type taxcalc (amount) but it wont work. I don't understand what I am doing wrong. The command is supposed to show the tax calculation by 8 percent of the given amount, but the bot just will not respond to the command. I am wondering if I am configuring the bot wrong but it could also be the code that is wrong.
# bot.py import os import discord from dotenv import load_dotenv load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') client = discord.Client() @client.event async def on_ready(): print(f'{client.user.name} has connected to Discord!') @client.event async def taxcalc(ctx, x: str): x = CHECK_M_K(str(x)) lost = x*0.08 lost2 = x*0.033045 plus = round(x + x*0.12) plost = int(plus-lost2) print("plus: "+str(plus)) print("plus lost: " + str(plost)) for i in range(int(plus-lost2), plus): if x > int(1e12): await ctx.channel.send("***IMPOSSIBLE! You definitely DO NOT have more than 1 trillion!!***") break temp = i lost = i-x lost = "{:,}".format(lost) i -= round(i*0.08) if (i == x): x = temp x = "{:,}".format(x) embed = discord.Embed(title="Tax Calculator", description="Amount expected to pay: `⏣ "+ x + "`\n" + "Amount lost by tax: `⏣ "+lost+"`\n" + "Tax rate: 8%", color=0xace1af) await ctx.channel.send(embed=embed) print(x) break elif x == 20: embed = discord.Embed(title="Tax Calculator", description="Amount expected to pay: `⏣ "+ str(x+2) + "`\n" + "Amount lost by tax: `⏣ 2`\n" + "Tax rate: 8%", color=0xace1af) await ctx.channel.send(embed=embed) print(x) break elif x > 6 and x < 19: embed = discord.Embed(title="Tax Calculator", description="Amount expected to pay: `⏣ "+ str(x+1) + "`\n" + "Amount lost by tax: `⏣ 1`\n" + "Tax rate: `8%`", color=0xace1af) await ctx.channel.send(embed=embed) print(x) break elif x <= 6: embed = discord.Embed(title="Tax Calculator", description="Amount expected to pay: `⏣ "+ str(x) + "`\n" + "Amount lost by tax: `⏣ 0`\n" + "Tax rate: `8%`", color=0xace1af) await ctx.channel.send(embed=embed) print(x) break else: i = 0 client.run(token removed lul)``` https://stackoverflow.com/questions/67428988/how-do-i-allow-this-script-to-work-properly May 07, 2021 at 12:21PM
没有评论:
发表评论