Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
7,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.76 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3. from core.api import api
  4. import time
  5. import requests
  6. import random
  7.  
  8. TOKEN = ""
  9.  
  10. client = commands.Bot(command_prefix='!s ')
  11. client.remove_command('help')
  12.  
  13.  
  14. @client.event
  15. async def on_ready():
  16.     print("--------------" * 20)
  17.     print('Eingeloggt als')
  18.     print(client.user.name)
  19.     print(client.user.id)
  20.     print("--------------" * 20)
  21.  
  22.  
  23. @client.command()
  24. async def shop():
  25.     apikey = 'ed70e21d-8107-4883-bbcb-994ae113ac0b'
  26.     request = api.Shop(apikey)
  27.     response = request.send()
  28.     shop = response.data
  29.  
  30.     embed = discord.Embed(
  31.         title="Fortnite-Shop vom **%s**" % time.strftime("%d.%m.%Y"),
  32.         color=discord.Colour.orange(),
  33.         description="The current item shop rotation for Fortnite Battle Royale - updates daily at 00:00 UTC."
  34.     )
  35.  
  36.     for item in shop.daily:
  37.         embed.add_field(
  38.  
  39.             name="Daily items:",
  40.             value="\t{0}: {1} V-Bucks".format(item.name, item.price)
  41.         )
  42.  
  43.     embed.add_field(
  44.         name="------------",
  45.         value="--" * 30
  46.     )
  47.     for item1 in shop.featured:
  48.         embed.add_field(
  49.  
  50.             name="Featured  items:",
  51.             value="\t{0}: {1} V-Bucks".format(item1.name, item1.price)
  52.         )
  53.  
  54.     embed.set_footer(
  55.         text="Powerd by Young-Devs & fnbr.co API.",
  56.     )
  57.     embed.set_thumbnail(url='https://image.fnbr.co/price/icon_vip.png')
  58.  
  59.     await client.say(embed=embed)
  60.  
  61.  
  62. @client.command()
  63. async def state():
  64.     baseURL = "https://fortnite-api.tresmos.xyz/status?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Inp1bmFtaWRldkBnbWFpbC5jb20iLCJ1c2VySWQiOiI1YmMxY2FhZWVlMzNjYTZjMGRmYjA1NGUifQ.kmW8e0jqdHsm1fbhjAhpbzRONiJa--3EBuLTrgaY9Pw"
  65.     param = dict()
  66.  
  67.     resp = requests.get(url=baseURL, params=param)
  68.  
  69.     data = resp.json()
  70.  
  71.     if data["boolean"] == 1:
  72.         status = discord.Embed(
  73.             title="Server state",
  74.             color=discord.Colour.green(),
  75.         )
  76.  
  77.         status.add_field(
  78.             name="Online",
  79.             value="The Fortnite server are Online."
  80.         )
  81.     else:
  82.         status = discord.Embed(
  83.             title="Server state",
  84.             color=0xFF0000
  85.         )
  86.  
  87.         status.add_field(
  88.             name="Offline",
  89.             value="The Fortnite server are Offline."
  90.         )
  91.  
  92.     await client.say(embed=status)
  93.  
  94.  
  95. @client.command()
  96. async def drop():
  97.     statd = ["Salty Springs", "Dusty Divot", "Tomato Temple", "Lazy Links", "Junk Junction", "Haunted Hills",
  98.              "Snobby Shores", "Greasy Grove", "Shifty Shafts", "Tilted Towers", "Leaky Lake", "Risky Reels",
  99.              "Wailing Woods", "Lonely Lodge", "Paradise Palms", "Lucky Landing", "Fatal Fields", "Flush Factory",
  100.              "Retail Row", "Pleasant Park"]
  101.  
  102.     ran = random.choice(statd)
  103.  
  104.     drop1 = discord.Embed(
  105.         title="Drop",
  106.         color=discord.Colour.orange(),
  107.     )
  108.  
  109.     drop1.add_field(
  110.         name=ran,
  111.         value="Jump out of the bus"
  112.     )
  113.  
  114.     drop1.set_footer(
  115.         text="Powerd by Young-Devs & fnbr.co API.",
  116.     )
  117.     drop1.set_thumbnail(url='https://image.fnbr.co/price/icon_vip.png')
  118.  
  119.     await client.say(embed=drop1)
  120.  
  121.  
  122. @client.command(pass_context=True)
  123. async def help(ctx):
  124.     author = ctx.message.author
  125.  
  126.     helpm = discord.Embed(
  127.         color=discord.Colour.orange(),
  128.     )
  129.  
  130.     helpm.set_author(name="Help")
  131.     helpm.add_field(name='!s shop', value="Shows you the daily Shop")
  132.     helpm.add_field(name='!s drop', value="Shows you a random Place in Fortnite")
  133.     helpm.add_field(name='!s stae', value="Shows you the Fortnite-BR server state")
  134.     helpm.add_field(name='!s help', value="Shows you the help menu")
  135.  
  136.     await client.send_message(author, embed=helpm)
  137.  
  138.  
  139. client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement