maybe can process applications now, I haven't tested it yet
This commit is contained in:
		
							
								
								
									
										25
									
								
								commands/admin.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								commands/admin.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					pendcount()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						getauth "admin/registration_application/count" ".registration_applications"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pending()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						applications=$(getauth "admin/registration_application/list" ".registration_applications" "unread_only=true")
 | 
				
			||||||
 | 
						i=0
 | 
				
			||||||
 | 
						app=$(jq .[$i] <<< "$applications")
 | 
				
			||||||
 | 
						while [ -n "$app" ]; do
 | 
				
			||||||
 | 
							appid=$(jq -r .registration_application.id <<< "$app")
 | 
				
			||||||
 | 
							jq '.registration_application.id, (.creator | .name,.published,.bio,"bot: "+.bot_account,"matrix: "+.matrix_user_id,.avatar,.banner), "captcha: "+.registration_application.answer' <<< "$app"
 | 
				
			||||||
 | 
							ans= # Better make sure this resets lol
 | 
				
			||||||
 | 
							while [ ! ans = 'y' -a ! ans = 'n' -a ! ans = 's' ]; do
 | 
				
			||||||
 | 
								namedget ans "Accept? (y)es (n)o (s)kip"
 | 
				
			||||||
 | 
							done
 | 
				
			||||||
 | 
							case $ans in
 | 
				
			||||||
 | 
								y) put "admin/registration_application/approve" "{\"id\":$appid,\"approve\":true}";;
 | 
				
			||||||
 | 
								n) namedget rejected "Why not?" true; put "admin/registration_application/approve" "{\"id\":$appid,\"deny_reason\":\"$rejected\",\"approve\":false}";;
 | 
				
			||||||
 | 
							esac
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -iX PUT $INSTANCE/api/v3/admin/registration_application/approve --json "{\"id\":8,\"auth\":\"$TOKE\",\"approve\":true}"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user