-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildwith0rbit.lua
More file actions
177 lines (149 loc) · 5.5 KB
/
Copy pathbuildwith0rbit.lua
File metadata and controls
177 lines (149 loc) · 5.5 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
-- processId: QQchTCEkPhnIu9dDSFyfR9-8mG-ftAkPt7Xs3AhtBjA
-- processName: buildWith0rbit
-- dev: @megabyte0x
Requests = Requests or {}
ACCEPTED_REQUESTS = ACCEPTED_REQUESTS or {}
function _ownerCheck(msg)
if (msg.From ~= ao.id) then
Handlers.utils.reply(Colors.red ..
"You are not authorized to perform this action.")(msg)
return false
end
return true
end
function addRequest(msg)
if Requests[msg.From] then
if (Requests[msg.From].request_processed == false) then
Handlers.utils.reply(Colors.blue ..
"You have already submitted a request. Please wait for the team to reach out to you.")(msg)
elseif (Requests[msg.From].request_rejected == true) then
Handlers.utils.reply(Colors.red ..
"Your request has been rejected.")(msg)
end
return
end
local twitter = msg.Twitter
local discord = msg.Discord
local project_name = msg.Project_Name
local project_description = msg.Project_Description
local project_requirement = msg.Project_Requirement
local no_of_0RBT_requested = msg.Request_Amount
local recepient_wallet = msg.Recepient_Wallet
Requests[msg.From] = {
twitter = twitter,
discord = discord,
project_name = project_name,
project_description = project_description,
project_requirement = project_requirement,
no_of_0RBT_requested = no_of_0RBT_requested,
recepient_wallet = recepient_wallet,
request_processed = false,
request_rejected = false
}
Handlers.utils.reply(Colors.green ..
"Your response is recorded. " ..
Colors.red ..
"No Action is Required from your end." .. "\n" .. Colors.blue .. "Our Team will reach out to you soon")(
msg)
end
function rejectRequest(msg)
if not _ownerCheck(msg) then
return
end
local requestId = msg.RequestId
if not Requests[requestId] then
Handlers.utils.reply(Colors.red ..
"No request found with the given ID.")(msg)
return
end
Requests[requestId].request_rejected = true
Handlers.utils.reply(Colors.red ..
"Request " .. requestId .. " has been rejected.")(msg)
end
function acceptRequest(msg)
if not _ownerCheck(msg) then
return
end
local requestId = msg.RequestId
if not Requests[requestId] then
Handlers.utils.reply(Colors.red ..
"No request found with the given ID.")(msg)
return
end
Requests[requestId].request_processed = true
ACCEPTED_REQUESTS[requestId] = Requests[requestId]
Requests[requestId] = nil
Handlers.utils.reply(Colors.green ..
"Request " .. requestId .. " has been accepted.")(msg)
end
function deleteRequest(msg)
if not _ownerCheck(msg) then
return
end
local requestId = msg.RequestId
if not Requests[requestId] then
Handlers.utils.reply(Colors.red ..
"No request found with the given ID.")(msg)
return
end
Requests[requestId] = nil
Handlers.utils.reply(Colors.gray ..
"Request " .. requestId .. " has been deleted.")(msg)
end
function info(msg)
local info = "A form to request 0RBT Points. " ..
"Please fill the form to request 0RBT Points. " ..
"The team will reach out to you soon. " .. "Sample request format: " ..
"Send({" ..
" Target = 'Kq_zJt98an1n9zOp2c82Vh3CBQcfRXVpPk940bd6N7U'," ..
" Action = 'Build-With-0rbit'," ..
" Twitter = 'Your Twitter Handle (ex. @megabyte0x)'," ..
" Discord = 'Your Discord Handle (ex. megabyte0x)'," ..
" Project_Name = 'Your Project Name (ex. 0rbit)'," ..
" Project_Description = 'Your Project Description (ex. The Decentralised Oracle Network on Arweave built using AO)'," ..
" Project_Requirement = 'Your project requirement for 0rbit (ex. Getting stock prices to build a prediction model)'," ..
" Request_Amount = 'Amount of 0RBT requested (ex. 1000)'," ..
" Recepient_Wallet = 'Your Arweave Wallet Address (ex. Pw6aamwaKdmlkgKMNLX1ekzvyBPO8r-S4QhIpL34QVw)'" ..
"})"
Handlers.utils.reply(Colors.blue .. info)(msg)
Send({ Target = msg.From, Data = info })
end
Handlers.add(
"CreateRequest",
Handlers.utils.hasMatchingTag("Action", "Build-With-0rbit"),
addRequest
)
Handlers.add(
"RejectRequest",
Handlers.utils.hasMatchingTag("Action", "Reject-Request"),
rejectRequest
)
Handlers.add(
"AcceptRequest",
Handlers.utils.hasMatchingTag("Action", "Accept-Request"),
acceptRequest
)
Handlers.add(
"DeleteRequest",
Handlers.utils.hasMatchingTag("Action", "Delete-Request"),
deleteRequest
)
Handlers.add(
"Info",
Handlers.utils.hasMatchingTag("Action", "Info"),
info
)
--[[
Sample Request
Send({
Target = "QQchTCEkPhnIu9dDSFyfR9-8mG-ftAkPt7Xs3AhtBjA",
Action = "Build-With-0rbit",
Twitter = "Your Twitter Handle (ex. @megabyte0x)",
Discord = "Your Discord Handle (ex. megabyte0x)",
Project_Name = "Your Project Name (ex. 0rbit)",
Project_Description = "Your Project Description (ex. The Decentralised Oracle Network on Arweave built using AO)",
Project_Requirement = "Your project requirement for 0rbit (ex. Getting stock prices to build a prediction model)",
Request_Amount = "Amount of 0RBT requested (ex. 1000)",
Recepient_Wallet = "Your Arweave Wallet Address (ex. Pw6aamwaKdmlkgKMNLX1ekzvyBPO8r-S4QhIpL34QVw)"
})
]]