fork download
  1. import nextcord, datetime, re, httpx, certifi
  2. from nextcord.ext import commands
  3. import json
  4.  
  5.  
  6. phoneNumber = "0984267600"
  7. serverId = 1335184514892169316
  8. token = "MTMwNzczOTc5MDUwNjA2NTk4MA.GC94wG.9X54uu5EbFknCRmbHKKzRFAF4R-Rae5m90FpuA"
  9. ownerIds = [1159764502166904882]
  10. channelLog = 1354797721072046160
  11.  
  12.  
  13. bot = commands.Bot(command_prefix='nyx!',
  14. help_command=None,
  15. intents=nextcord.Intents.all(),
  16. strip_after_prefix=True,
  17. case_insensitive=True)
  18.  
  19.  
  20. class topupModal(nextcord.ui.Modal):
  21.  
  22. def __init__(self):
  23. super().__init__(title='เติมเงิน', timeout=None, custom_id='topup-modal')
  24. self.link = nextcord.ui.TextInput(
  25. label='ลิ้งค์ซองอังเปา',
  26. placeholder='https://g...content-available-to-author-only...y.com/campaign/?v=xxxxxxxxxxxxxxx',
  27. style=nextcord.TextInputStyle.short,
  28. required=True)
  29. self.add_item(self.link)
  30.  
  31. async def callback(self, interaction: nextcord.Interaction):
  32. link = str(self.link.value).replace(' ', '')
  33. message = await interaction.response.send_message(content='checking.',
  34. ephemeral=True)
  35. if re.match(
  36. r'https:\/\/gift\.truemoney\.com\/campaign\/\?v=+[a-zA-Z0-9]{18}',
  37. link):
  38. voucher_hash = link.split('?v=')[1]
  39. response = httpx.post(
  40. url=
  41. f'https://g...content-available-to-author-only...y.com/campaign/vouchers/{voucher_hash}/redeem',
  42. headers={
  43. 'User-Agent':
  44. 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/8a0.0.3987.149 Safari/537.36'
  45. },
  46. json={
  47. 'mobile': 'phoneNumber',
  48. 'voucher_hash': f'{voucher_hash}'
  49. },
  50. verify=certifi.where(),
  51. )
  52. if (response.status_code == 200
  53. and response.json()['status']['code'] == 'SUCCESS'):
  54. data = response.json()
  55. amount = int(float(data['data']['my_ticket']['amount_baht']))
  56. userJSON = json.load(
  57. open('./database/users.json', 'r', encoding='utf-8'))
  58. if (str(interaction.user.id) not in userJSON):
  59. userJSON[str(interaction.user.id)] = {
  60. "userId":
  61. interaction.user.id,
  62. "point":
  63. amount,
  64. "all-point":
  65. amount,
  66. "transaction": [{
  67. "topup": {
  68. "url": link,
  69. "amount": amount,
  70. "time": str(datetime.datetime.now())
  71. }
  72. }]
  73. }
  74. else:
  75. userJSON[str(interaction.user.id)]['point'] += amount
  76. userJSON[str(interaction.user.id)]['all-point'] += amount
  77. userJSON[str(interaction.user.id)]['transaction'].append({
  78. "topup": {
  79. "url": link,
  80. "amount": amount,
  81. "time": str(datetime.datetime.now())
  82. }
  83. })
  84. json.dump(userJSON,
  85. open('./database/users.json', 'w', encoding='utf-8'),
  86. indent=4,
  87. ensure_ascii=False)
  88. embed = nextcord.Embed(description='✅﹒**เติมเงินสำเร็จ**',
  89. color=nextcord.Color.green())
  90. else:
  91. embed = nextcord.Embed(description='❌﹒**เติมเงินไม่สำเร็จ**',
  92. color=nextcord.Color.red())
  93. else:
  94. embed = nextcord.Embed(description='⚠﹒**รูปแบบลิ้งค์ไม่ถูกต้อง**',
  95. color=nextcord.Color.red())
  96. await message.edit(content=None, embed=embed)
  97.  
  98.  
  99. class sellroleView(nextcord.ui.View):
  100.  
  101. def __init__(self, message: nextcord.Message, value: str):
  102. super().__init__(timeout=None)
  103. self.message = message
  104. self.value = value
  105.  
  106. @nextcord.ui.button(label='✅﹒ยืนยัน',
  107. custom_id='already',
  108. style=nextcord.ButtonStyle.primary,
  109. row=1)
  110. async def already(self, button: nextcord.Button,
  111. interaction: nextcord.Interaction):
  112. roleJSON = json.load(open('./database/roles.json', 'r', encoding='utf-8'))
  113. userJSON = json.load(open('./database/users.json', 'r', encoding='utf-8'))
  114. if (str(interaction.user.id) not in userJSON):
  115. embed = nextcord.Embed(description='🏦﹒เติมเงินเพื่อเปิดบัญชี',
  116. color=nextcord.Color.red())
  117. else:
  118. if (userJSON[str(interaction.user.id)]['point'] >=
  119. roleJSON[self.value]['price']):
  120. userJSON[str(
  121. interaction.user.id)]['point'] -= roleJSON[self.value]['price']
  122. userJSON[str(interaction.user.id)]['transaction'].append({
  123. "payment": {
  124. "roleId": self.value,
  125. "time": str(datetime.datetime.now())
  126. }
  127. })
  128. json.dump(userJSON,
  129. open('./database/users.json', 'w', encoding='utf-8'),
  130. indent=4,
  131. ensure_ascii=False)
  132. if ('package' in self.value):
  133. for roleId in roleJSON[self.value]['roleIds']:
  134. try:
  135. await interaction.user.add_roles(
  136. nextcord.utils.get(interaction.user.guild.roles, id=roleId))
  137. except:
  138. pass
  139. channelLog = bot.get_channel(channelLog)
  140. if (channelLog):
  141. embed = nextcord.Embed()
  142. embed.set_thumbnail(url=interaction.user.avatar.url)
  143. embed.title = '»»——— ประวัติการซื้อยศ ——-««<'
  144. embed.description = f'''
  145. ﹒𝐔𝐬𝐞𝐫 : **<@{interaction.user.id}>**
  146. ﹒𝐍𝐚𝐦𝐞 : **{interaction.user.name}**
  147. ﹒𝐏𝐫𝐢𝐜𝐞 : **{roleJSON[self.value]['price']}**𝐓𝐇𝐁
  148. ﹒𝐆𝐞𝐭𝐑𝐨𝐥𝐞 : <@&{roleJSON[self.value]["roleId"]}>
  149. »»——— SEX SSMD ——-««<'''
  150. embed.color = nextcord.Color.blue()
  151. embed.set_footer(
  152. text='SEX SSMD AUTO BUY ROLE',
  153. icon_url=
  154. 'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
  155. )
  156. await channelLog.send(embed=embed)
  157. embed = nextcord.Embed(
  158. description=
  159. f'💲﹒ซื้อยศสำเร็จ ได้รับ <@&{roleJSON[self.value]["name"]}>',
  160. color=nextcord.Color.green())
  161. else:
  162. channelLog = bot.get_channel('channelLog')
  163. if (channelLog):
  164. embed = nextcord.Embed()
  165. embed.set_thumbnail(url=interaction.user.avatar.url)
  166. embed.title = '»»——— ประวัติการซื้อยศ ——-««<'
  167. embed.description = f'''
  168. ﹒𝐔𝐬𝐞𝐫 : **<@{interaction.user.id}>**
  169. ﹒𝐍𝐚𝐦𝐞 : **{interaction.user.name}**
  170. ﹒𝐏𝐫𝐢𝐜𝐞 : **{roleJSON[self.value]['price']}**𝐓𝐇𝐁
  171. ﹒𝐆𝐞𝐭𝐑𝐨𝐥𝐞 : <@&{roleJSON[self.value]["roleId"]}>
  172. »»——— SEX SSMD ——-««<'''
  173. embed.color = nextcord.Color.blue()
  174. embed.set_footer(
  175. text='SEX SSMD AUTO BUY ROLE',
  176. icon_url=
  177. 'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
  178. )
  179. await channelLog.send(embed=embed)
  180. embed = nextcord.Embed(
  181. description=
  182. f'💲﹒ซื้อยศสำเร็จ ได้รับยศ <@&{roleJSON[self.value]["roleId"]}>',
  183. color=nextcord.Color.green())
  184. role = nextcord.utils.get(interaction.user.guild.roles,
  185. id=roleJSON[self.value]['roleId'])
  186. await interaction.user.add_roles(role)
  187. else:
  188. embed = nextcord.Embed(
  189. description=
  190. f'⚠﹒เงินของท่านไม่เพียงพอ ขาดอีก ({roleJSON[self.value]["price"] - userJSON[str(interaction.user.id)]["point"]})',
  191. color=nextcord.Color.red())
  192. return await self.message.edit(embed=embed, view=None, content=None)
  193.  
  194. @nextcord.ui.button(label='❌﹒ยกเลิก',
  195. custom_id='cancel',
  196. style=nextcord.ButtonStyle.red,
  197. row=1)
  198. async def cancel(self, button: nextcord.Button,
  199. interaction: nextcord.Interaction):
  200. return await self.message.edit(content='💚﹒ยกเลิกสำเร็จ',
  201. embed=None,
  202. view=None)
  203.  
  204.  
  205. class sellroleSelect(nextcord.ui.Select):
  206.  
  207. def __init__(self):
  208. options = []
  209. roleJSON = json.load(open('./database/roles.json', 'r', encoding='utf-8'))
  210. for role in roleJSON:
  211. options.append(
  212. nextcord.SelectOption(label=roleJSON[role]['name'],
  213. description=roleJSON[role]['description'],
  214. value=role,
  215. emoji=roleJSON[role]['emoji']))
  216. super().__init__(custom_id='select-role',
  217. placeholder='[ เลือกยศที่คุณต้องการซื้อ ]',
  218. min_values=1,
  219. max_values=1,
  220. options=options,
  221. row=0)
  222.  
  223. async def callback(self, interaction: nextcord.Interaction):
  224. message = await interaction.response.send_message(
  225. content='[SELECT] กำลังตรวจสอบ', ephemeral=True)
  226. selected = self.values[0]
  227. if ('package' in selected):
  228. roleJSON = json.load(open('./database/roles.json', 'r',
  229. encoding='utf-8'))
  230. embed = nextcord.Embed()
  231. embed.description = f'''
  232. E {roleJSON[selected]['name']}**
  233. '''
  234. await message.edit(content=None,
  235. embed=embed,
  236. view=sellroleView(message=message, value=selected))
  237. else:
  238. roleJSON = json.load(open('./database/roles.json', 'r',
  239. encoding='utf-8'))
  240. embed = nextcord.Embed()
  241. embed.title = '»»——— ยืนยันการสั่งซื้อ ——-««'
  242. embed.description = f'''
  243. \n คุณแน่ใจหรอที่จะซื้อ <@&{roleJSON[selected]['roleId']}> \n
  244. »»——— SEX SSMD ——-««
  245. '''
  246. embed.color = nextcord.Color.blue()
  247. embed.set_thumbnail(
  248. url=
  249. 'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
  250. )
  251. await message.edit(content=None,
  252. embed=embed,
  253. view=sellroleView(message=message, value=selected))
  254.  
  255.  
  256. class setupView(nextcord.ui.View):
  257.  
  258. def __init__(self):
  259. super().__init__(timeout=None)
  260. self.add_item(sellroleSelect())
  261.  
  262. @nextcord.ui.button(label='🧧﹒เติมเงิน',
  263. custom_id='topup',
  264. style=nextcord.ButtonStyle.primary,
  265. row=1)
  266. async def topup(self, button: nextcord.Button,
  267. interaction: nextcord.Interaction):
  268. await interaction.response.send_modal(topupModal())
  269.  
  270. @nextcord.ui.button(label='💳﹒เช็คเงิน',
  271. custom_id='balance',
  272. style=nextcord.ButtonStyle.primary,
  273. row=1)
  274. async def balance(self, button: nextcord.Button,
  275. interaction: nextcord.Interaction):
  276. userJSON = json.load(open('./database/users.json', 'r', encoding='utf-8'))
  277. if (str(interaction.user.id) not in userJSON):
  278. embed = nextcord.Embed(description='🏦﹒เติมเงินเพื่อเปิดบัญชี',
  279. color=nextcord.Color.red())
  280. else:
  281. embed = nextcord.Embed(
  282. description=
  283. f'╔═══════▣◎▣═══════╗\n\n💳﹒ยอดเงินคงเหลือ **__{userJSON[str(interaction.user.id)]["point"]}__** บาท\n\n╚═══════▣◎▣═══════╝',
  284. color=nextcord.Color.green())
  285. return await interaction.response.send_message(embed=embed, ephemeral=True)
  286.  
  287.  
  288. @bot.event
  289. async def on_ready():
  290. bot.add_view(setupView())
  291. print(f'LOGIN AS {bot.user}')
  292.  
  293.  
  294. @bot.slash_command(name='setup',
  295. description='setup',
  296. guild_ids=[serverId])
  297. async def setup(interaction: nextcord.Interaction):
  298. if (interaction.user.id not in ownerIds):
  299. return await interaction.response.send_message(
  300. content='[ERROR] No Permission For Use This Command.', ephemeral=True)
  301. embed = nextcord.Embed()
  302. embed.title = '─── SEX SSMD ───'
  303. embed.description = f'''
  304. ```
  305. ─────────────────────────────────────
  306. 🧧﹒บอทซื้อยศ 24 ชั่วโมง 💚
  307.  
  308. ・ 💳﹒เติมเงินด้วยระบบอั่งเปา
  309. ・ ✨﹒ระบบออโต้ 24 ชั่วโมง
  310. ・ 💲﹒ซื้อแล้วได้ยศเลย
  311. ・ 🔓﹒เติมเงินเพื่อเปิดบัญชี
  312. ─────────────────────────────────────```
  313. '''
  314. embed.color = nextcord.Color.blue()
  315. embed.set_image(
  316. url=
  317. 'https://i...content-available-to-author-only...p.net/external/JDnpFIEpRqs3lXwgtc6zk023mQP0KD5GDkXbRbWkAUM/https/www.checkraka.com/uploaded/img/content/130026/aungpao_truewallet_01.jpg'
  318. )
  319. embed.set_thumbnail(
  320. url=
  321. 'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
  322. )
  323. await interaction.channel.send(embed=embed, view=setupView())
  324. await interaction.response.send_message(content='[SUCCESS] Done.',
  325. ephemeral=True)
  326.  
  327.  
  328. bot.run(token)
  329.  
Success #stdin #stdout 0.03s 25692KB
stdin
Standard input is empty
stdout
import nextcord, datetime, re, httpx, certifi
from nextcord.ext import commands
import json


phoneNumber = "0984267600"
serverId = 1335184514892169316
token = "MTMwNzczOTc5MDUwNjA2NTk4MA.GC94wG.9X54uu5EbFknCRmbHKKzRFAF4R-Rae5m90FpuA"
ownerIds = [1159764502166904882]
channelLog = 1354797721072046160


bot = commands.Bot(command_prefix='nyx!',
                   help_command=None,
                   intents=nextcord.Intents.all(),
                   strip_after_prefix=True,
                   case_insensitive=True)


class topupModal(nextcord.ui.Modal):

  def __init__(self):
    super().__init__(title='เติมเงิน', timeout=None, custom_id='topup-modal')
    self.link = nextcord.ui.TextInput(
        label='ลิ้งค์ซองอังเปา',
        placeholder='https://g...content-available-to-author-only...y.com/campaign/?v=xxxxxxxxxxxxxxx',
        style=nextcord.TextInputStyle.short,
        required=True)
    self.add_item(self.link)

  async def callback(self, interaction: nextcord.Interaction):
    link = str(self.link.value).replace(' ', '')
    message = await interaction.response.send_message(content='checking.',
                                                      ephemeral=True)
    if re.match(
        r'https:\/\/gift\.truemoney\.com\/campaign\/\?v=+[a-zA-Z0-9]{18}',
        link):
      voucher_hash = link.split('?v=')[1]
      response = httpx.post(
          url=
          f'https://g...content-available-to-author-only...y.com/campaign/vouchers/{voucher_hash}/redeem',
          headers={
              'User-Agent':
              'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/8a0.0.3987.149 Safari/537.36'
          },
          json={
              'mobile': 'phoneNumber',
              'voucher_hash': f'{voucher_hash}'
          },
          verify=certifi.where(),
      )
      if (response.status_code == 200
          and response.json()['status']['code'] == 'SUCCESS'):
        data = response.json()
        amount = int(float(data['data']['my_ticket']['amount_baht']))
        userJSON = json.load(
            open('./database/users.json', 'r', encoding='utf-8'))
        if (str(interaction.user.id) not in userJSON):
          userJSON[str(interaction.user.id)] = {
              "userId":
              interaction.user.id,
              "point":
              amount,
              "all-point":
              amount,
              "transaction": [{
                  "topup": {
                      "url": link,
                      "amount": amount,
                      "time": str(datetime.datetime.now())
                  }
              }]
          }
        else:
          userJSON[str(interaction.user.id)]['point'] += amount
          userJSON[str(interaction.user.id)]['all-point'] += amount
          userJSON[str(interaction.user.id)]['transaction'].append({
              "topup": {
                  "url": link,
                  "amount": amount,
                  "time": str(datetime.datetime.now())
              }
          })
        json.dump(userJSON,
                  open('./database/users.json', 'w', encoding='utf-8'),
                  indent=4,
                  ensure_ascii=False)
        embed = nextcord.Embed(description='✅﹒**เติมเงินสำเร็จ**',
                               color=nextcord.Color.green())
      else:
        embed = nextcord.Embed(description='❌﹒**เติมเงินไม่สำเร็จ**',
                               color=nextcord.Color.red())
    else:
      embed = nextcord.Embed(description='⚠﹒**รูปแบบลิ้งค์ไม่ถูกต้อง**',
                             color=nextcord.Color.red())
    await message.edit(content=None, embed=embed)


class sellroleView(nextcord.ui.View):

  def __init__(self, message: nextcord.Message, value: str):
    super().__init__(timeout=None)
    self.message = message
    self.value = value

  @nextcord.ui.button(label='✅﹒ยืนยัน',
                      custom_id='already',
                      style=nextcord.ButtonStyle.primary,
                      row=1)
  async def already(self, button: nextcord.Button,
                    interaction: nextcord.Interaction):
    roleJSON = json.load(open('./database/roles.json', 'r', encoding='utf-8'))
    userJSON = json.load(open('./database/users.json', 'r', encoding='utf-8'))
    if (str(interaction.user.id) not in userJSON):
      embed = nextcord.Embed(description='🏦﹒เติมเงินเพื่อเปิดบัญชี',
                             color=nextcord.Color.red())
    else:
      if (userJSON[str(interaction.user.id)]['point'] >=
          roleJSON[self.value]['price']):
        userJSON[str(
            interaction.user.id)]['point'] -= roleJSON[self.value]['price']
        userJSON[str(interaction.user.id)]['transaction'].append({
            "payment": {
                "roleId": self.value,
                "time": str(datetime.datetime.now())
            }
        })
        json.dump(userJSON,
                  open('./database/users.json', 'w', encoding='utf-8'),
                  indent=4,
                  ensure_ascii=False)
        if ('package' in self.value):
          for roleId in roleJSON[self.value]['roleIds']:
            try:
              await interaction.user.add_roles(
                  nextcord.utils.get(interaction.user.guild.roles, id=roleId))
            except:
              pass
          channelLog = bot.get_channel(channelLog)
          if (channelLog):
            embed = nextcord.Embed()
            embed.set_thumbnail(url=interaction.user.avatar.url)
            embed.title = '»»——— ประวัติการซื้อยศ ——-««<'
            embed.description = f'''
                       ﹒𝐔𝐬𝐞𝐫 : **<@{interaction.user.id}>**
                       ﹒𝐍𝐚𝐦𝐞 : **{interaction.user.name}**
                       ﹒𝐏𝐫𝐢𝐜𝐞 : **{roleJSON[self.value]['price']}**𝐓𝐇𝐁
                       ﹒𝐆𝐞𝐭𝐑𝐨𝐥𝐞 : <@&{roleJSON[self.value]["roleId"]}>
                       »»——— SEX SSMD ——-««<'''
            embed.color = nextcord.Color.blue()
            embed.set_footer(
                text='SEX SSMD AUTO BUY ROLE',
                icon_url=
                'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
            )
            await channelLog.send(embed=embed)
          embed = nextcord.Embed(
              description=
              f'💲﹒ซื้อยศสำเร็จ ได้รับ <@&{roleJSON[self.value]["name"]}>',
              color=nextcord.Color.green())
        else:
          channelLog = bot.get_channel('channelLog')
          if (channelLog):
            embed = nextcord.Embed()
            embed.set_thumbnail(url=interaction.user.avatar.url)
            embed.title = '»»——— ประวัติการซื้อยศ ——-««<'
            embed.description = f'''
                       ﹒𝐔𝐬𝐞𝐫 : **<@{interaction.user.id}>**
                       ﹒𝐍𝐚𝐦𝐞 : **{interaction.user.name}**
                       ﹒𝐏𝐫𝐢𝐜𝐞 : **{roleJSON[self.value]['price']}**𝐓𝐇𝐁
                       ﹒𝐆𝐞𝐭𝐑𝐨𝐥𝐞 : <@&{roleJSON[self.value]["roleId"]}>
                       »»——— SEX SSMD ——-««<'''
            embed.color = nextcord.Color.blue()
            embed.set_footer(
                text='SEX SSMD AUTO BUY ROLE',
                icon_url=
                'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
            )
            await channelLog.send(embed=embed)
          embed = nextcord.Embed(
              description=
              f'💲﹒ซื้อยศสำเร็จ ได้รับยศ <@&{roleJSON[self.value]["roleId"]}>',
              color=nextcord.Color.green())
          role = nextcord.utils.get(interaction.user.guild.roles,
                                    id=roleJSON[self.value]['roleId'])
          await interaction.user.add_roles(role)
      else:
        embed = nextcord.Embed(
            description=
            f'⚠﹒เงินของท่านไม่เพียงพอ ขาดอีก ({roleJSON[self.value]["price"] - userJSON[str(interaction.user.id)]["point"]})',
            color=nextcord.Color.red())
    return await self.message.edit(embed=embed, view=None, content=None)

  @nextcord.ui.button(label='❌﹒ยกเลิก',
                      custom_id='cancel',
                      style=nextcord.ButtonStyle.red,
                      row=1)
  async def cancel(self, button: nextcord.Button,
                   interaction: nextcord.Interaction):
    return await self.message.edit(content='💚﹒ยกเลิกสำเร็จ',
                                   embed=None,
                                   view=None)


class sellroleSelect(nextcord.ui.Select):

  def __init__(self):
    options = []
    roleJSON = json.load(open('./database/roles.json', 'r', encoding='utf-8'))
    for role in roleJSON:
      options.append(
          nextcord.SelectOption(label=roleJSON[role]['name'],
                                description=roleJSON[role]['description'],
                                value=role,
                                emoji=roleJSON[role]['emoji']))
    super().__init__(custom_id='select-role',
                     placeholder='[ เลือกยศที่คุณต้องการซื้อ ]',
                     min_values=1,
                     max_values=1,
                     options=options,
                     row=0)

  async def callback(self, interaction: nextcord.Interaction):
    message = await interaction.response.send_message(
        content='[SELECT] กำลังตรวจสอบ', ephemeral=True)
    selected = self.values[0]
    if ('package' in selected):
      roleJSON = json.load(open('./database/roles.json', 'r',
                                encoding='utf-8'))
      embed = nextcord.Embed()
      embed.description = f'''
E {roleJSON[selected]['name']}**
'''
      await message.edit(content=None,
                         embed=embed,
                         view=sellroleView(message=message, value=selected))
    else:
      roleJSON = json.load(open('./database/roles.json', 'r',
                                encoding='utf-8'))
      embed = nextcord.Embed()
      embed.title = '»»——— ยืนยันการสั่งซื้อ ——-««'
      embed.description = f'''
           \n คุณแน่ใจหรอที่จะซื้อ <@&{roleJSON[selected]['roleId']}> \n
»»——— SEX SSMD ——-««
'''
      embed.color = nextcord.Color.blue()
      embed.set_thumbnail(
          url=
          'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
      )
      await message.edit(content=None,
                         embed=embed,
                         view=sellroleView(message=message, value=selected))


class setupView(nextcord.ui.View):

  def __init__(self):
    super().__init__(timeout=None)
    self.add_item(sellroleSelect())

  @nextcord.ui.button(label='🧧﹒เติมเงิน',
                      custom_id='topup',
                      style=nextcord.ButtonStyle.primary,
                      row=1)
  async def topup(self, button: nextcord.Button,
                  interaction: nextcord.Interaction):
    await interaction.response.send_modal(topupModal())

  @nextcord.ui.button(label='💳﹒เช็คเงิน',
                      custom_id='balance',
                      style=nextcord.ButtonStyle.primary,
                      row=1)
  async def balance(self, button: nextcord.Button,
                    interaction: nextcord.Interaction):
    userJSON = json.load(open('./database/users.json', 'r', encoding='utf-8'))
    if (str(interaction.user.id) not in userJSON):
      embed = nextcord.Embed(description='🏦﹒เติมเงินเพื่อเปิดบัญชี',
                             color=nextcord.Color.red())
    else:
      embed = nextcord.Embed(
          description=
          f'╔═══════▣◎▣═══════╗\n\n💳﹒ยอดเงินคงเหลือ **__{userJSON[str(interaction.user.id)]["point"]}__** บาท\n\n╚═══════▣◎▣═══════╝',
          color=nextcord.Color.green())
    return await interaction.response.send_message(embed=embed, ephemeral=True)


@bot.event
async def on_ready():
  bot.add_view(setupView())
  print(f'LOGIN AS {bot.user}')


@bot.slash_command(name='setup',
                   description='setup',
                   guild_ids=[serverId])
async def setup(interaction: nextcord.Interaction):
  if (interaction.user.id not in ownerIds):
    return await interaction.response.send_message(
        content='[ERROR] No Permission For Use This Command.', ephemeral=True)
  embed = nextcord.Embed()
  embed.title = '───                    SEX SSMD                ───'
  embed.description = f'''
```
─────────────────────────────────────
🧧﹒บอทซื้อยศ 24 ชั่วโมง 💚

・ 💳﹒เติมเงินด้วยระบบอั่งเปา
・ ✨﹒ระบบออโต้ 24 ชั่วโมง
・ 💲﹒ซื้อแล้วได้ยศเลย
・ 🔓﹒เติมเงินเพื่อเปิดบัญชี
─────────────────────────────────────```
'''
  embed.color = nextcord.Color.blue()
  embed.set_image(
      url=
      'https://i...content-available-to-author-only...p.net/external/JDnpFIEpRqs3lXwgtc6zk023mQP0KD5GDkXbRbWkAUM/https/www.checkraka.com/uploaded/img/content/130026/aungpao_truewallet_01.jpg'
  )
  embed.set_thumbnail(
      url=
      'https://c...content-available-to-author-only...p.com/attachments/1205701187760816229/1206256575438786610/standard.gif?ex=65db58fa&is=65c8e3fa&hm=28edaf0e22f45916e553cab9b6bcd8199a042886778b66f5d6940f8669de3a56&'
  )
  await interaction.channel.send(embed=embed, view=setupView())
  await interaction.response.send_message(content='[SUCCESS] Done.',
                                          ephemeral=True)


bot.run(token)