mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 17:04:15 +02:00
refactor(arabot): insert awaits to schedule creators
This commit is contained in:
parent
b6b50ea450
commit
d90c985cec
@ -56,7 +56,10 @@ import { rolesToString } from '#utils/formatter';
|
|||||||
import IDs from '#utils/ids';
|
import IDs from '#utils/ids';
|
||||||
|
|
||||||
export class VerificationJoinVCListener extends Listener {
|
export class VerificationJoinVCListener extends Listener {
|
||||||
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
|
public constructor(
|
||||||
|
context: Listener.LoaderContext,
|
||||||
|
options: Listener.Options,
|
||||||
|
) {
|
||||||
super(context, {
|
super(context, {
|
||||||
...options,
|
...options,
|
||||||
event: 'voiceStateUpdate',
|
event: 'voiceStateUpdate',
|
||||||
@ -151,14 +154,15 @@ export class VerificationJoinVCListener extends Listener {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Start 15-minute timer if verifier does not join
|
// Start 15-minute timer if verifier does not join
|
||||||
this.container.tasks.create({
|
await this.container.tasks.create(
|
||||||
name: 'verifyTimeout',
|
{
|
||||||
payload: {
|
name: 'verifyTimeout',
|
||||||
channelId: channel.id,
|
payload: {
|
||||||
userId: member.id,
|
channelId: channel.id,
|
||||||
|
userId: member.id,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
900_000, // 15 minutes
|
||||||
900_000 // 15 minutes
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,13 +511,14 @@ export class VerificationJoinVCListener extends Listener {
|
|||||||
await giveVerificationRoles(user, info.roles);
|
await giveVerificationRoles(user, info.roles);
|
||||||
// Add timeout if they do not have activist role
|
// Add timeout if they do not have activist role
|
||||||
if (!info.roles.activist) {
|
if (!info.roles.activist) {
|
||||||
this.container.tasks.create({
|
await this.container.tasks.create(
|
||||||
name: 'verifyUnblock',
|
{
|
||||||
payload: {
|
name: 'verifyUnblock',
|
||||||
userId: user.id,
|
payload: {
|
||||||
guildId: guild.id,
|
userId: user.id,
|
||||||
|
guildId: guild.id,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
info.roles.vegan || info.roles.convinced ? 604800000 : 1814400000,
|
info.roles.vegan || info.roles.convinced ? 604800000 : 1814400000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,10 @@ import { fibonacci } from '#utils/maths';
|
|||||||
import IDs from '#utils/ids';
|
import IDs from '#utils/ids';
|
||||||
|
|
||||||
export class VerificationLeaveVCListener extends Listener {
|
export class VerificationLeaveVCListener extends Listener {
|
||||||
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
|
public constructor(
|
||||||
|
context: Listener.LoaderContext,
|
||||||
|
options: Listener.Options,
|
||||||
|
) {
|
||||||
super(context, {
|
super(context, {
|
||||||
...options,
|
...options,
|
||||||
event: 'voiceStateUpdate',
|
event: 'voiceStateUpdate',
|
||||||
@ -103,14 +106,15 @@ export class VerificationLeaveVCListener extends Listener {
|
|||||||
// Creates the length of the time for the ban
|
// Creates the length of the time for the ban
|
||||||
const banLength = fibonacci(incompleteCount) * 3600_000;
|
const banLength = fibonacci(incompleteCount) * 3600_000;
|
||||||
|
|
||||||
this.container.tasks.create({
|
await this.container.tasks.create(
|
||||||
name: 'verifyUnblock',
|
{
|
||||||
payload: {
|
name: 'verifyUnblock',
|
||||||
userId: user.id,
|
payload: {
|
||||||
guildId: guild.id,
|
userId: user.id,
|
||||||
|
guildId: guild.id,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
banLength,
|
||||||
banLength,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await user.user
|
await user.user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user