-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_pasa.py
More file actions
81 lines (68 loc) · 2.71 KB
/
request_pasa.py
File metadata and controls
81 lines (68 loc) · 2.71 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os, traceback
import interactions
from interactions import ChannelType, GuildText, OptionType, Extension, SlashContext, slash_command, slash_option, File, SlashCommandChoice, listen, Task, IntervalTrigger, TimeTrigger
from dotenv import load_dotenv
import json
import re
import requests
import time
import asyncio
import random
import sqlite3
import datetime
from datetime import datetime, timedelta, timezone
import secrets
import hashlib
import binascii
file_name = os.path.basename(__file__)
load_dotenv()
bottoken=os.getenv("TOKEN")
nodedownmessage = os.getenv("NODEDOWNMESSAGE")
sqlitedblocation = os.getenv("SQLITEDBLOCATION")
apitoken = os.getenv("APITOKEN")
cexaccount = os.getenv("CEXACCOUNT")
devfee = os.getenv("DEVFEE")
devacc = os.getenv("DEVACC")
withdrawpayload = binascii.hexlify(os.getenv("WITHDRAWPAYLOAD").encode('utf-8')).decode('utf-8')
devfeepayload = binascii.hexlify(os.getenv("DEVFEEPAYLOAD").encode('utf-8')).decode('utf-8')
imagepayload = binascii.hexlify(os.getenv("IMAGEPAYLOAD").encode('utf-8')).decode('utf-8')
operation_channel = os.getenv("OPCHANNEL")
imagecost = os.getenv("IMAGECOST")
os.makedirs(os.path.dirname(sqlitedblocation), exist_ok=True)
con = sqlite3.connect(sqlitedblocation)
cur = con.cursor()
def initsqlite():
con = sqlite3.connect(sqlitedblocation)
cur = con.cursor()
res = cur.execute("SELECT name FROM sqlite_master")
check = res.fetchone() is None
if check == True:
cur.execute("CREATE TABLE verification(owner, account, vernumber, verified, timestamp TIMESTAMP)")
cur.execute("CREATE TABLE data(block)")
cur.execute("INSERT INTO data VALUES(-1)")
cur.execute("CREATE TABLE cex(owner, hash, balance)")
cur.execute("CREATE TABLE price(price, currency)")
cur.execute("CREATE TABLE verifiedops(hash, optxt)")
cur.execute("CREATE TABLE image(user, notice, num_prompts_day)")
con.commit()
else:
return
initsqlite()
class request_pasa(Extension):
@interactions.slash_command(name="request_pasa", description="Request a PASA through dispenser.pascalcoin.org")
@slash_option(name="public_key", description="Your wallet public key", opt_type = OptionType.STRING, required= True)
async def request_pasa(self, ctx, public_key: str):
url = "https://dispenser.pascalcoin.org/api.php"
data = {
'request': 'requestPASADiscordAPI',
'handle': f'{ctx.author.display_name}',
'token': apitoken,
'publicKey' : f'{public_key}'
}
response = requests.post(url, data=data)
if response.status_code == 200:
data = json.loads(response.text)
if data['status'] == 1:
await ctx.send(f"```ansi\n[31;1mError: {data['error']}\n```", ephemeral = True)
if data['status'] == 0:
await ctx.send(f"```ansi\n[32;1m{data['data']['message']}\n```", ephemeral = True)