Skip to content

Commit

Permalink
Remove poll command (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanndlin authored Apr 2, 2024
1 parent 47a3ad1 commit c720417
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 312 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Lion has 3 ways of interacting with a user
- [Example](https://github.com/cs-discord-at-ucf/lion/blob/master/src/app/handlers/user_update.handler.ts)
3. [Job](https://github.com/cs-discord-at-ucf/lion/blob/master/src/common/job.ts)
- Code that is run on a set interval
- [Example](https://github.com/cs-discord-at-ucf/lion/blob/master/src/app/jobs/poll.job.ts)
- [Example](https://github.com/cs-discord-at-ucf/lion/blob/master/src/app/jobs/inactivevoice.job.ts)

The best place to start is a plugin. This is a simple as it gets, after following the instructions from the [readme](https://github.com/cs-discord-at-ucf/lion/blob/master/README.md), put whatever code you want to run in the `execute` function, and you will see that this code runs when a user calls this plugin.

Expand Down
148 changes: 0 additions & 148 deletions src/app/commands/poll.command.ts

This file was deleted.

30 changes: 0 additions & 30 deletions src/app/jobs/poll.job.ts

This file was deleted.

24 changes: 11 additions & 13 deletions src/bootstrap/container.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import Bottle from 'bottlejs';
import { ClientService } from '../services/client.service';
import { HttpService } from '../services/http.service';
import { PluginService } from '../services/plugin.service';
import { MessageService } from '../services/message.service';
import { ChannelService } from '../services/channel.service';
import { ClassService } from '../services/class.service';
import { ClientService } from '../services/client.service';
import { ControllerService } from '../services/controller.service';
import { GameLeaderboardService } from '../services/gameleaderboard.service';
import { GuildService } from '../services/guild.service';
import { HandlerService } from '../services/handler.service';
import { HttpService } from '../services/http.service';
import { JobService } from '../services/job.service';
import { StoreService } from '../services/store.service';
import { ModService } from '../services/moderation.service';
import { StorageService } from '../services/storage.service';
import { LoggerService } from '../services/logger.service';
import { MessageService } from '../services/message.service';
import { ModService } from '../services/moderation.service';
import { PluginService } from '../services/plugin.service';
import { PointService } from '../services/point.service';
import { RoleService } from '../services/role.service';
import { PollService } from '../services/poll.service';
import { WarningService } from '../services/warning.service';
import { GameLeaderboardService } from '../services/gameleaderboard.service';
import { StorageService } from '../services/storage.service';
import { StoreService } from '../services/store.service';
import { UserService } from '../services/user.service';
import { ControllerService } from '../services/controller.service';
import { PointService } from '../services/point.service';
import { WarningService } from '../services/warning.service';

export class Container {
constructor(private _bottle: Bottle) {
Expand Down Expand Up @@ -49,7 +48,6 @@ export class Container {
'warningService'
);
this._bottle.service('roleService', RoleService);
this._bottle.service('pollService', PollService, 'clientService');
this._bottle.service('warningService', WarningService, 'clientService', 'guildService');
this._bottle.service('gameLeaderboardService', GameLeaderboardService, 'storageService');
this._bottle.service(
Expand Down
2 changes: 0 additions & 2 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { MessageService } from '../services/message.service';
import { ModService } from '../services/moderation.service';
import { PluginService } from '../services/plugin.service';
import { PointService } from '../services/point.service';
import { PollService } from '../services/poll.service';
import { RoleService } from '../services/role.service';
import { StorageService } from '../services/storage.service';
import { StoreService } from '../services/store.service';
Expand Down Expand Up @@ -50,7 +49,6 @@ export interface IContainer extends BottleContainer {
storageService: StorageService;
loggerService: LoggerService;
roleService: RoleService;
pollService: PollService;
warningService: WarningService;
gameLeaderboardService: GameLeaderboardService;
userService: UserService;
Expand Down
15 changes: 4 additions & 11 deletions src/services/job.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { ExampleJob } from '../app/jobs/example.job';
import { Job } from '../common/job';
import { IContainer, IJobEvent } from '../common/types';
import { UnBanJob } from '../app/jobs/unban.job';
import { InactiveVoiceJob } from '../app/jobs/inactivevoice.job';
import { PollJob } from '../app/jobs/poll.job';
import { UnBanJob } from '../app/jobs/unban.job';
import { WarningJob } from '../app/jobs/warning.job';
import { Job } from '../common/job';
import { IContainer, IJobEvent } from '../common/types';

export class JobService {
public jobs: Job[] = [
new ExampleJob(),
new UnBanJob(),
new InactiveVoiceJob(),
new PollJob(),
new WarningJob(),
];
public jobs: Job[] = [new ExampleJob(), new UnBanJob(), new InactiveVoiceJob(), new WarningJob()];
private _runningJobs: { [jobName: string]: NodeJS.Timeout } = {};

public initJobStates(container: IContainer): Promise<void> {
Expand Down
3 changes: 1 addition & 2 deletions src/services/plugin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ export class PluginService {

const usages = plugin.usage.split('\n');

// Poll is the only exception where args are required on new lines
const shouldAddPrefixes = !['poll', 'alt'].includes(plugin.commandName);
const shouldAddPrefixes = plugin.commandName !== 'alt';

// Put a ! infront of every usage on new line
const withPrefix = `${Constants.Prefix}${usages.join(
Expand Down
105 changes: 0 additions & 105 deletions src/services/poll.service.ts

This file was deleted.

0 comments on commit c720417

Please sign in to comment.