Я хочу получить идентификатор сервера из файла JSON, который я не совсем понимаю, как это сделать.Ниже мой текущий файл Python
import discord
from discord.ext import commands
import youtube_dl
import json
with open("configs/premium.json") as f:
premium = json.load(f)
def premium(bot, message):
id = message.server.id
return premium.get(id)
class Play:
def __init__(self, client):
self.client = client
@commands.command(pass_context=True)
async def play(self, ctx):
try:
if ctx.message.server.id == premium:
await self.client.say('Premium works')
else:
await self.client.say('Non-Premium Works!')
except Exception as error:
await self.client.say('{}'.format(error))
def setup(client):
client.add_cog(Play(client))
Файл JSON
{"serverID":"498054637245693952"}