How to update the list items when doing a certain command(discord.py bot)
I have a list of nsfw words as a json file in my discord bot folder. What I want to do is, when I type ".add (word)", the word gets added to the list. I have made this command, and it works too, since when I type that word again it gets deleted. But when I check the list from my IDE, its still the old one. Moreover, when I stop the bot and run it again, the word gets removed from memory, which makes sense.
How do I make it so that when I do the command, the list gets updated in real time? Any help about this site would be appreciated!
Here is my code snippet:
@commands.command()
async def add(self, ctx, word):
await ctx.message.delete()
file.append(word)
await ctx.channel.send("Done.")
and here is my list in a json file:
nsfw_list = [nsfw word, nsfw word, nsfw word...etc]
-
Please join https://discord.gg/discord-developers for general questions about the API.
Otherwise for specific Bot API questions, join https://discord.gg/discord-api
0
Please sign in to leave a comment.
Comments
1 comment