cute puppy warning
This commit is contained in:
parent
1ac5f5c1f7
commit
ea5842d292
|
|
@ -14,16 +14,16 @@ class ParticipantController extends Controller
|
||||||
return response()->json(['message' => 'Unauthorized: Wrong password'], 401);
|
return response()->json(['message' => 'Unauthorized: Wrong password'], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Participant::where('id', $id)->exists()) {
|
if(!Participant::where('user_id', $id)->exists()) {
|
||||||
$participant = Participant::create([
|
$participant = Participant::create([
|
||||||
'user_id' => $id,
|
'user_id' => $id,
|
||||||
'token' => (string) Str::ulid()
|
'token' => uniqid()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $participant->token;
|
return $participant->token;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$participant = Participant::where('id', $id)->first();
|
$participant = Participant::where('user_id', $id)->first();
|
||||||
return $participant->token;
|
return $participant->token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
bot/main.py
13
bot/main.py
|
|
@ -64,17 +64,22 @@ async def make_new_json_request(user_id: int):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.post(url, json=data, headers=headers) as response:
|
async with session.post(url, json=data, headers=headers) as response:
|
||||||
response_text = await response.text()
|
response_text = await response.text()
|
||||||
return response_text
|
if(len(response_text) < 14):
|
||||||
|
return response_text
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
async def post_chat_update(session: aiohttp.ClientSession, chat_object: Dict[str, Any], xsrf_token: str):
|
async def post_chat_update(session: aiohttp.ClientSession, chat_object: Dict[str, Any], xsrf_token: str):
|
||||||
pattern = r'/(\d+)/'
|
pattern = r'/(\d+)/'
|
||||||
match = re.search(pattern, chat_object.get('icon_url'))
|
match = re.search(pattern, chat_object.get('icon_url'))
|
||||||
|
|
||||||
token = await make_new_json_request(match.group(1))
|
token = await make_new_json_request(match.group(1))
|
||||||
|
|
||||||
form_data = aiohttp.FormData()
|
form_data = aiohttp.FormData()
|
||||||
form_data.add_field('text', f"""You've signed up for the Secret Sketchers event, your link is http://localhost/profile/{token} - it is private and should only be used by you.
|
if(token):
|
||||||
\nDon't want to be in it anymore? Go to http://localhost/withdraw/{token} - note that withdrawing is permanent and you cannot re-enter the event.""")
|
form_data.add_field('text', f"""You've signed up for the Secret Sketchers event, your link is http://localhost/profile/{token} - it is private and should only be used by you.
|
||||||
|
\nDon't want to be in it anymore? Go to http://localhost/withdraw/{token} - note that withdrawing is permanent and you cannot re-enter the event.""")
|
||||||
|
else:
|
||||||
|
form_data.add_field('text', f"""Something went wrong, Sorry I will fix it sooner or later... maybe""")
|
||||||
|
|
||||||
headers = get_post_headers(xsrf_token)
|
headers = get_post_headers(xsrf_token)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class ParticipantFactory extends Factory
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'token' => (string) Str::ulid(),
|
'token' => uniqid(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue