refactor(arabot): insert awaits to schedule creators

This commit is contained in:
Anthony Berg 2024-01-06 02:30:05 +00:00
parent b6b50ea450
commit d90c985cec
2 changed files with 31 additions and 22 deletions

View File

@ -56,7 +56,10 @@ import { rolesToString } from '#utils/formatter';
import IDs from '#utils/ids';
export class VerificationJoinVCListener extends Listener {
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
public constructor(
context: Listener.LoaderContext,
options: Listener.Options,
) {
super(context, {
...options,
event: 'voiceStateUpdate',
@ -151,14 +154,15 @@ export class VerificationJoinVCListener extends Listener {
]);
// Start 15-minute timer if verifier does not join
this.container.tasks.create({
await this.container.tasks.create(
{
name: 'verifyTimeout',
payload: {
channelId: channel.id,
userId: member.id,
},
},
900_000 // 15 minutes
900_000, // 15 minutes
);
}
@ -507,7 +511,8 @@ export class VerificationJoinVCListener extends Listener {
await giveVerificationRoles(user, info.roles);
// Add timeout if they do not have activist role
if (!info.roles.activist) {
this.container.tasks.create({
await this.container.tasks.create(
{
name: 'verifyUnblock',
payload: {
userId: user.id,

View File

@ -37,7 +37,10 @@ import { fibonacci } from '#utils/maths';
import IDs from '#utils/ids';
export class VerificationLeaveVCListener extends Listener {
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
public constructor(
context: Listener.LoaderContext,
options: Listener.Options,
) {
super(context, {
...options,
event: 'voiceStateUpdate',
@ -103,7 +106,8 @@ export class VerificationLeaveVCListener extends Listener {
// Creates the length of the time for the ban
const banLength = fibonacci(incompleteCount) * 3600_000;
this.container.tasks.create({
await this.container.tasks.create(
{
name: 'verifyUnblock',
payload: {
userId: user.id,