allows replybot to post regular statuses too
This commit is contained in:
		| @ -19,7 +19,7 @@ const emoteChoice = async () =>{ // pulls current emojis from the instance | ||||
|     return emoteArray[Math.floor(Math.random() * emoteArray.length)]; | ||||
| }; | ||||
|  | ||||
| const replyChoice = async () =>{ | ||||
| const statusChoice = async () =>{ | ||||
|     const replyArr = [ // add desired replies here - it's just a big ass array | ||||
|         "example1", | ||||
|         "example 2", | ||||
| @ -28,6 +28,18 @@ const replyChoice = async () =>{ | ||||
|     return replyArr[Math.floor(Math.random() * replyArr.length)]; | ||||
| }; | ||||
|  | ||||
| export const postRegularStatus = async () =>{ | ||||
|     const headers = {Authorization: `Bearer ${process.env.REPLYBOT_BEARER}`, "Content-Type": "application/json"}; | ||||
|     const emoji = await emoteChoice(); | ||||
|     const word = await statusChoice(); | ||||
|     const res = await fetch(`https://${process.env.INSTANCE_NAME}/api/v1/statuses`, { | ||||
|       method: "POST", | ||||
|       headers: headers, | ||||
|       body: JSON.stringify({status: `${word} :${emoji}:`}), | ||||
|     }); | ||||
|     if (res.status === 200) {console.log('Replybot posted regular status!')} else {console.log('Replybot failed (regular status):', res.status, res.statusText, res.url, word, emoji)} | ||||
|   }; | ||||
|  | ||||
| export const postReply = async () =>{ | ||||
|     const headers = {Authorization: `Bearer ${process.env.REPLYBOT_BEARER}`, "Content-Type": "application/json"}; | ||||
|     const mentions = []; | ||||
| @ -39,7 +51,7 @@ export const postReply = async () =>{ | ||||
|         } | ||||
|     }; | ||||
|     const emoji = await emoteChoice(); | ||||
|     const word = await replyChoice(); | ||||
|     const word = await statusChoice(); | ||||
|     const res = await fetch(`https://${process.env.INSTANCE_NAME}/api/v1/statuses`, { | ||||
|       method: "POST", | ||||
|       headers: headers, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user