UNPKG

8.81 kBJavaScriptView Raw
1const fetch = require('node-fetch')
2const baseurl = 'https://frenchnoodles.xyz/api/endpoints/'
3
4
5
6async function request(endpoint, input='') {
7 const res = await fetch(`${baseurl}${endpoint}/?${input}`, {
8 headers: {'User-Agent': `noodles-wrapper@${process.env.npm_package_version}(https://www.npmjs.com/package/noodles-wrapper) by French Noodles#4000`}
9 });
10 return res
11}
12
13module.exports.drake = async function(text1, text2) {
14 if(!text1) throw new Error('The field text1 was left empty in the drake function')
15 if(!text2) throw new Error('The field text2 was left empty in the drake function')
16 const input = `text1=${encodeURIComponent(text1)}&text2=${encodeURIComponent(text2)}`
17 const response = await request('drake', input)
18 return response.buffer()
19}
20
21module.exports.worthless = async function(text) {
22 if(!text) throw new Error('The field text was left empty in worthless function')
23 const input = `text=${encodeURIComponent(text)}`
24 const response = await request('worthless', input)
25 return response.buffer()
26}
27
28module.exports.presidentialalert = async function(text) {
29 if(!text) throw new Error('The field text was left empty in presidentialalert function')
30 const input = `text=${encodeURIComponent(text)}`
31 const response = await request('presidentialalert', input)
32 return response.buffer()
33}
34
35module.exports.spongebobburnpaper = async function(text) {
36 if(!text) throw new Error('The field text was left empty in spongebobburnpaper function')
37 const input = `text=${encodeURIComponent(text)}`
38 const response = await request('spongebobburnpaper', input)
39 return response.buffer()
40}
41
42
43module.exports.lisastage = async function(text) {
44 if(!text) throw new Error('The field text was left empty in lisastage function')
45 const input = `text=${encodeURIComponent(text)}`
46 const response = await request('lisastage', input)
47 return response.buffer()
48}
49
50module.exports.changemymind = async function(text) {
51 if(!text) throw new Error('The field text was left empty in changemymind function')
52 const input = `text=${encodeURIComponent(text)}`
53 const response = await request('changemymind', input)
54 return response.buffer()
55}
56
57module.exports.awkwardmonkey = async function(text) {
58 if(!text) throw new Error('The field text was left empty in awkwardmonkey function')
59 const input = `text=${encodeURIComponent(text)}`
60 const response = await request('awkwardmonkey', input)
61 return response.buffer()
62}
63
64module.exports.blur = async function(image) {
65 if(!image) throw new Error('The field text was left empty in blur function')
66 const input = `image=${encodeURIComponent(image)}`
67 const response = await request('blur', input)
68 return response.buffer()
69}
70
71module.exports.invert = async function(image) {
72 if(!image) throw new Error('The field text was left empty in invert function')
73 const input = `image=${encodeURIComponent(image)}`
74 const response = await request('invert', input)
75 return response.buffer()
76}
77
78module.exports.edges = async function(image) {
79 if(!image) throw new Error('The field text was left empty in edges function')
80 const input = `image=${encodeURIComponent(image)}`
81 const response = await request('edges', input)
82 return response.buffer()
83}
84
85module.exports.circle = async function(image) {
86 if(!image) throw new Error('The field text was left empty in circle function')
87 const input = `image=${encodeURIComponent(image)}`
88 const response = await request('circle', input)
89 return response.buffer()
90}
91
92module.exports.wide = async function(image) {
93 if(!image) throw new Error('The field text was left empty in wide function')
94 const input = `image=${encodeURIComponent(image)}`
95 const response = await request('wide', input)
96 return response.buffer()
97}
98
99module.exports.uglyupclose = async function(image) {
100 if(!image) throw new Error('The field text was left empty in uglyupclose function')
101 const input = `image=${encodeURIComponent(image)}`
102 const response = await request('uglyupclose', input)
103 return response.buffer()
104}
105
106module.exports.clown = async function(image) {
107 if(!image) throw new Error('The field text was left empty in clown function')
108 const input = `image=${encodeURIComponent(image)}`
109 const response = await request('clown', input)
110 return response.buffer()
111}
112
113module.exports.rip = async function(image) {
114 if(!image) throw new Error('The field text was left empty in rip function')
115 const input = `image=${encodeURIComponent(image)}`
116 const response = await request('rip', input)
117 return response.buffer()
118}
119
120module.exports.affectbaby = async function(image) {
121 if(!image) throw new Error('The field text was left empty in affectbaby function')
122 const input = `image=${encodeURIComponent(image)}`
123 const response = await request('affectbaby', input)
124 return response.buffer()
125}
126
127module.exports.trash = async function(image) {
128 if(!image) throw new Error('The field text was left empty in trash function')
129 const input = `image=${encodeURIComponent(image)}`
130 const response = await request('trash', input)
131 return response.buffer()
132}
133
134module.exports.welcomebanner = class welcomebanner{
135 constructor(){}
136 setBackground(value) { this.background = value; return this}
137 setAvatar(value) { this.avatar = value; return this}
138 setTitle(value) { this.title = value; return this}
139 setText1(value) { this.text1 = value; return this}
140 setSubtitle(value) { this.subtitle = value; return this}
141 setTextColor(value) { this.textcolor = value; return this}
142 build(){
143 return welcomebannerbuild(this.background, this.avatar, this.title, this.text1, this.subtitle, this.textcolor);
144 }
145}
146async function welcomebannerbuild(background, avatar, title, text1, subtitle, textcolor) {
147 if(!background) throw new Error('The field background was left empty in welcomebanner function')
148 if(!avatar) throw new Error('The field avatar was left empty in welcomebanner function')
149 if(!title) throw new Error('The field title was left empty in welcomebanner function')
150 if(!text1) throw new Error('The field text1 was left empty in welcomebanner function')
151 if(!text2) throw new Error('The field text2 was left empty in welcomebanner function')
152 if(!textcolor) throw new Error('The field textcolor was left empty in welcomebanner function')
153 const input = `background=${encodeURIComponent(background)}&avatar=${encodeURIComponent(avatar)}&title=${encodeURIComponent(title)}&text1=${encodeURIComponent(text1)}&subtitle=${encodeURIComponent(subtitle)}&textcolor=${encodeURIComponent(textcolor.replace('#', ''))}`
154 const response = await request('welcomebanner', input)
155 return response.buffer()
156}
157
158module.exports.boostercard = async function(image) {
159 if(!image) throw new Error('The field text was left empty in boostercard function')
160 const input = `image=${encodeURIComponent(image)}`
161 const response = await request('boostercard', input)
162 return response.buffer()
163}
164
165module.exports.balancecard = class balancecard{
166 constructor(){}
167 setBackground(value) { this.background = value; return this}
168 setAvatar(value) { this.avatar = value; return this}
169 setTitle(value) { this.title = value; return this}
170 setText1(value) { this.text1 = value; return this}
171 setText2(value) { this.text2 = value; return this}
172 setTextColor(value) { this.textcolor = value; return this}
173 build(){
174 return balancecardbuild(this.background, this.avatar, this.title, this.text1, this.text2, this.textcolor);
175 }
176}
177async function balancecardbuild(background, avatar, title, text1, text2, textcolor) {
178 if(!background) throw new Error('The field background was left empty in balancecard function')
179 if(!avatar) throw new Error('The field avatar was left empty in balancecard function')
180 if(!title) throw new Error('The field title was left empty in balancecard function')
181 if(!text1) throw new Error('The field text1 was left empty in balancecard function')
182 if(!text2) throw new Error('The field text2 was left empty in balancecard function')
183 if(!textcolor) throw new Error('The field textcolor was left empty in balancecard function')
184 const input = `background=${encodeURIComponent(background)}&avatar=${encodeURIComponent(avatar)}&title=${encodeURIComponent(title)}&text1=${encodeURIComponent(text1)}&text2=${encodeURIComponent(text2)}&textcolor=${encodeURIComponent(textcolor.replace('#', ''))}`
185 const response = await request('balancecard', input)
186 return response.buffer()
187}
188
189module.exports.randommeme = async function() {
190 const response = await request('randommeme')
191 return response.buffer()
192}
\No newline at end of file