Hi I'm trying to access a function inside the class which houses the Discord bot. Getting TypeError: sendTrade() missing 1 required positional argument: 'valuta'. MyClient.sendTrade() is called from within a while loop in another functions which is run inside a thread. Any help much appreciated.
MyClient.sendTrade(pris, volym, befattning, getTicker(isin), namn, valuta)
class MyClient(discord.Client):
async def on_ready(self):
print('Logged in as')
print(self.user.name)
print(self.user.id)
print('------')
async def sendTrade(self, pris, volym, befattning, ticker, namn, valuta):
id = 930909133224435737
channel = MyClient.get_channel(id)
await channel.message.send("" + str(befattning) + " köpte " + str(ticker) + " för " + str(float(pris)*float(volym)/1000000) + " M" + valuta +" i " + namn + " för " + str(pris) + " per aktie")
if __name__ == '__main__':
Thread(target=clearLst).start()
Thread(target=monitor).start()
client = MyClient()
client.run(token)
source https://stackoverflow.com/questions/70687869/problems-with-discord-py-and-other-functions-running-simultaneously
Comments
Post a Comment