-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBananoPriceBotNoToken.py
32 lines (28 loc) · 1.19 KB
/
BananoPriceBotNoToken.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import aiohttp
import asyncio
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import datetime
import time
PREFIX = ("$")
client = commands.Bot(command_prefix = PREFIX, description = "VITC Price")
localtime = time.asctime( time.localtime(time.time()) )
delay = int(input("How many seconds delay would you like to have (recommended 30): "))
@client.event
async def on_ready():
while True:
async with aiohttp.ClientSession() as session:
api_url = "https://vitex.vite.net/api/v1/exchange-rate?tokenSymbols=BAN-001"
print("Opening URL: success")
async with session.get(api_url) as resp:
api_data = await resp.json()
data = api_data["data"]
usdRate = data[0]["usdRate"]
print("Waiting for " + str(delay) + " seconds to pass.....")
# waiting
time.sleep(delay)
# changing status
await client.change_presence(activity = discord.Activity(type = discord.ActivityType.watching, name = str(usdRate) + "$"))
print("Updated status to " + str(usdRate) + " @ " + str(localtime))
client.run("TOKEN HERE")