Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

store command in discord.py

#create a json file (example: store.json)
@bot.command()
@commands.has_permissions(administrator=True)
async def store(ctx):
    with open('store.json') as json_file:
        data = json.load(json_file)
        store = {"channel_id" : ctx.channel.id, "guild_id" : ctx.guild.id}
      
        data.append(store)
    with open('store.json', 'w') as f:
        json.dump(data, f, indent=4)
Source by github.com #
 
PREVIOUS NEXT
Tagged: #store #command
ADD COMMENT
Topic
Name
5+8 =