Merge branch 'dev'

merge-requests/24/head
Matthew 2021-03-22 17:34:42 -04:00
commit 938fa878bf
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
12 changed files with 11 additions and 56 deletions

View File

@ -12,7 +12,6 @@ import {
Member, MemberInterface, Member, MemberInterface,
Merchant, MerchantInterface, Merchant, MerchantInterface,
Moderation, ModerationInterface, Moderation, ModerationInterface,
NNTrainingData, NNTrainingDataInterface,
Note, NoteInterface, Note, NoteInterface,
PagerNumber, PagerNumberInterface, PagerNumber, PagerNumberInterface,
Promo, PromoInterface, Promo, PromoInterface,
@ -44,7 +43,7 @@ export default class Client extends eris.Client {
public stripe: Stripe; public stripe: Stripe;
public db: { Customer: mongoose.Model<CustomerInterface>, CustomerPortal: mongoose.Model<CustomerPortalInterface>, File: mongoose.Model<FileInterface>, Inquiry: mongoose.Model<InquiryInterface>, Member: mongoose.Model<MemberInterface>, Merchant: mongoose.Model<MerchantInterface>, Moderation: mongoose.Model<ModerationInterface>, NNTrainingData: mongoose.Model<NNTrainingDataInterface>, Note: mongoose.Model<NoteInterface>, PagerNumber: mongoose.Model<PagerNumberInterface>, Promo: mongoose.Model<PromoInterface>, Rank: mongoose.Model<RankInterface>, Redirect: mongoose.Model<RedirectInterface>, Score: mongoose.Model<ScoreInterface>, ScoreHistorical: mongoose.Model<ScoreHistoricalInterface>, Staff: mongoose.Model<StaffInterface>, Stat: mongoose.Model<StatInterface>, local: { muted: LocalStorage } }; public db: { Customer: mongoose.Model<CustomerInterface>, CustomerPortal: mongoose.Model<CustomerPortalInterface>, File: mongoose.Model<FileInterface>, Inquiry: mongoose.Model<InquiryInterface>, Member: mongoose.Model<MemberInterface>, Merchant: mongoose.Model<MerchantInterface>, Moderation: mongoose.Model<ModerationInterface>, Note: mongoose.Model<NoteInterface>, PagerNumber: mongoose.Model<PagerNumberInterface>, Promo: mongoose.Model<PromoInterface>, Rank: mongoose.Model<RankInterface>, Redirect: mongoose.Model<RedirectInterface>, Score: mongoose.Model<ScoreInterface>, ScoreHistorical: mongoose.Model<ScoreHistoricalInterface>, Staff: mongoose.Model<StaffInterface>, Stat: mongoose.Model<StatInterface>, local: { muted: LocalStorage } };
constructor(token: string, options?: eris.ClientOptions) { constructor(token: string, options?: eris.ClientOptions) {
super(token, options); super(token, options);
@ -52,7 +51,7 @@ export default class Client extends eris.Client {
this.events = new Collection<Event>(); this.events = new Collection<Event>();
this.intervals = new Collection<NodeJS.Timeout>(); this.intervals = new Collection<NodeJS.Timeout>();
this.queue = new Queue(this); this.queue = new Queue(this);
this.db = { Customer, CustomerPortal, File, Inquiry, Member, Merchant, Moderation, NNTrainingData, Note, PagerNumber, Promo, Rank, Redirect, Score, ScoreHistorical, Staff, Stat, local: { muted: new LocalStorage('muted') } }; this.db = { Customer, CustomerPortal, File, Inquiry, Member, Merchant, Moderation, Note, PagerNumber, Promo, Rank, Redirect, Score, ScoreHistorical, Staff, Stat, local: { muted: new LocalStorage('muted') } };
} }
get report() { get report() {

View File

@ -6,7 +6,7 @@ export default class AddRedirect extends Command {
super(client); super(client);
this.name = 'addredirect'; this.name = 'addredirect';
this.description = 'Adds a redirect link for \'loc.sh\''; this.description = 'Adds a redirect link for \'loc.sh\'';
this.usage = 'addredirect <redirect to url> <key>'; this.usage = `${this.client.config.prefix}addredirect <redirect to url> <key>`;
this.aliases = ['ar']; this.aliases = ['ar'];
this.permissions = 6; this.permissions = 6;
this.enabled = true; this.enabled = true;

View File

@ -10,7 +10,7 @@ export default class Profile extends Command {
super(client); super(client);
this.name = 'profile'; this.name = 'profile';
this.description = 'Manages your profile on CR.'; this.description = 'Manages your profile on CR.';
this.usage = 'profile <bio/github/gitlab> <new value>\n*Provide no value in subcommand to clear data.*'; this.usage = `${this.client.config.prefix}profile <bio/github/gitlab> <new value>\n*Provide no value in subcommand to clear data.*`;
this.permissions = 0; this.permissions = 0;
this.enabled = true; this.enabled = true;
this.subcmds = [Profile_Bio, Profile_GitHub, Profile_Gitlab]; this.subcmds = [Profile_Bio, Profile_GitHub, Profile_Gitlab];

View File

@ -6,7 +6,7 @@ export default class Profile_Bio extends Command {
super(client); super(client);
this.name = 'bio'; this.name = 'bio';
this.description = 'Updates your bio on your profile.'; this.description = 'Updates your bio on your profile.';
this.usage = `${this.client.config.prefix}bio <new bio>`; this.usage = `${this.client.config.prefix}profile bio <new bio>`;
this.permissions = 0; this.permissions = 0;
this.enabled = true; this.enabled = true;
} }

View File

@ -6,7 +6,7 @@ export default class Profile_GitHub extends Command {
super(client); super(client);
this.name = 'github'; this.name = 'github';
this.description = 'Updates your GitHub information on your profile.'; this.description = 'Updates your GitHub information on your profile.';
this.usage = `${this.client.config.prefix}github <GitHub profile URL>`; this.usage = `${this.client.config.prefix}profile github <GitHub profile URL>`;
this.permissions = 0; this.permissions = 0;
this.enabled = true; this.enabled = true;
} }

View File

@ -6,7 +6,7 @@ export default class Profile_GitLab extends Command {
super(client); super(client);
this.name = 'gitlab'; this.name = 'gitlab';
this.description = 'Updates your GitLab information on your profile.'; this.description = 'Updates your GitLab information on your profile.';
this.usage = `${this.client.config.prefix}gitlab <GitLab profile URL>`; this.usage = `${this.client.config.prefix}profile gitlab <GitLab profile URL>`;
this.permissions = 0; this.permissions = 0;
this.enabled = true; this.enabled = true;
} }

View File

@ -27,7 +27,7 @@ export default class Score_Hist extends Command {
if (!args[0] || !this.checkCustomPermissions(this.client.util.resolveMember(message.author.id, this.mainGuild), 4)) { if (!args[0] || !this.checkCustomPermissions(this.client.util.resolveMember(message.author.id, this.mainGuild), 4)) {
user = message.author; user = message.author;
if (!user) return this.error(message.channel, 'Member not found.'); if (!user) return this.error(message.channel, 'Member not found.');
const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).lean().exec(); const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).limit(31).lean().exec();
if (!hists) return this.error(message.channel, 'No history found.'); if (!hists) return this.error(message.channel, 'No history found.');
if (hists.length < 1) return this.error(message.channel, 'No history found.'); if (hists.length < 1) return this.error(message.channel, 'No history found.');
const histArray: [{ name: string, value: string }?] = []; const histArray: [{ name: string, value: string }?] = [];
@ -177,7 +177,7 @@ export default class Score_Hist extends Command {
user = this.client.util.resolveMember(sc.userID, this.mainGuild)?.user; user = this.client.util.resolveMember(sc.userID, this.mainGuild)?.user;
} }
if (!user) return this.error(message.channel, 'Member not found.'); if (!user) return this.error(message.channel, 'Member not found.');
const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).lean().exec(); const hists = await this.client.db.ScoreHistorical.find({ userID: user.id }).limit(31).lean().exec();
if (!hists) return this.error(message.channel, 'No history found.'); if (!hists) return this.error(message.channel, 'No history found.');
if (hists.length < 1) return this.error(message.channel, 'No history found.'); if (hists.length < 1) return this.error(message.channel, 'No history found.');
const histArray: [{ name: string, value: string }?] = []; const histArray: [{ name: string, value: string }?] = [];

View File

@ -5,8 +5,8 @@ export default class Setnick extends Command {
constructor(client: Client) { constructor(client: Client) {
super(client); super(client);
this.name = 'setnick'; this.name = 'setnick';
this.description = 'Changes the nickname of a member'; this.description = 'Changes the nickname of a member.';
this.usage = 'setnick <member> [new nickname]'; this.usage = `${this.client.config.prefix}setnick <member> [new nickname]`;
this.permissions = 2; this.permissions = 2;
this.guildOnly = true; this.guildOnly = true;
this.enabled = true; this.enabled = true;

View File

@ -1,29 +0,0 @@
/* eslint-disable no-unreachable */
import { Message } from 'eris';
import { Client, Event, LocalStorage } from '../class';
export default class Training extends Event {
public client: Client;
public storage: LocalStorage;
constructor(client: Client) {
super(client);
this.event = 'messageCreate';
this.storage = new LocalStorage('training');
}
public async run(message: Message) {
return;
try {
if (message.channel.id !== '485680288123584525') return;
await this.storage.set(message.id, {
content: message.content,
date: new Date(),
score: -1,
});
} catch (err) {
this.client.util.handleError(err, message);
}
}
}

View File

@ -2,4 +2,3 @@ export { default as CallBackHandler } from './CallBackHandler';
export { default as CommandHandler } from './CommandHandler'; export { default as CommandHandler } from './CommandHandler';
export { default as guildMemberAdd } from './guildMemberAdd'; export { default as guildMemberAdd } from './guildMemberAdd';
export { default as ready } from './ready'; export { default as ready } from './ready';
export { default as Training } from './Training';

View File

@ -1,13 +0,0 @@
import { Document, Schema, model } from 'mongoose';
export interface NNTrainingDataInterface extends Document {
name: string,
data: [{ input: any, output: object }];
}
const NNTrainingData: Schema = new Schema({
name: String,
data: Array,
});
export default model<NNTrainingDataInterface>('NNTrainingData', NNTrainingData);

View File

@ -5,7 +5,6 @@ export { default as Inquiry, InquiryInterface, InqType } from './Inquiry';
export { default as Member, MemberInterface } from './Member'; export { default as Member, MemberInterface } from './Member';
export { default as Merchant, MerchantInterface } from './Merchant'; export { default as Merchant, MerchantInterface } from './Merchant';
export { default as Moderation, ModerationInterface } from './Moderation'; export { default as Moderation, ModerationInterface } from './Moderation';
export { default as NNTrainingData, NNTrainingDataInterface } from './NNTrainingData';
export { default as Note, NoteInterface } from './Note'; export { default as Note, NoteInterface } from './Note';
export { default as PagerNumber, PagerNumberInterface, PagerNumberRaw } from './PagerNumber'; export { default as PagerNumber, PagerNumberInterface, PagerNumberRaw } from './PagerNumber';
export { default as Promo, PromoInterface } from './Promo'; export { default as Promo, PromoInterface } from './Promo';