2021年3月17日星期三

Reading data from a text file (discord.py)

I'm currently working on a feature for my Discord Bot that stores usernames for different gaming platforms like; Steam, Battle.net, Epic Games, etc. I'd like whenever I am to execute a specific command and mention a user in the guild, It would read the text file and send all of the usernames for each launcher associated with their discord account from a text file in an embed. I am unsure how I am supposed to create a command like this since I do not have experience with logging information in Python.

I have a bit of an idea i have created

@client.command() @commands.has_permissions(administrator=True) async def connections(ctx, member: discord.Member): embed=discord.Embed(title="CONNECTIONS", description="Connections associated with **"+ str(member) + ("**."),color=0xfffffD) embed.add_field(name="Steam", value="steam_name", inline=False) await ctx.send(embed=embed)

Everytime I mention a user at the end of the command, It should open a file and look for that user in the file, then it should find the connections associated with it like steam_name

If possible, I'd like to get assistance with the creation of this feature.

Thanks, Horizon

https://stackoverflow.com/questions/66631515/reading-data-from-a-text-file-discord-py March 15, 2021 at 10:07AM

没有评论:

发表评论