Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1147 extension #1213

Merged
merged 2 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/classes/Commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default class Commands {
'You',
'/quote',
'/pre',
'/pre2',
'/me',
'/code',
'Oh',
Expand Down
7 changes: 6 additions & 1 deletion src/classes/Commands/sub-classes/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as timersPromises from 'timers/promises';
import path from 'path';
import child from 'child_process';
import dayjs from 'dayjs';
import { Message as DiscordMessage } from 'discord.js';
import { EPersonaState } from 'steam-user';
import { EFriendRelationship } from 'steam-user';
import { removeLinkProtocol } from '../functions/utils';
Expand Down Expand Up @@ -528,7 +529,11 @@ export default class ManagerCommands {
}
}

this.bot.sendMessage(steamID, '/pre ' + ManagerCommands.generateAutokeysReply(steamID, this.bot));
this.bot.sendMessage(
steamID,
(steamID.redirectAnswerTo instanceof DiscordMessage ? '/pre2' : '/pre ') +
ManagerCommands.generateAutokeysReply(steamID, this.bot)
);
}

refreshAutokeysCommand(steamID: SteamID): void {
Expand Down
3 changes: 2 additions & 1 deletion src/classes/Commands/sub-classes/Misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SteamID from 'steamid';
import SKU from '@tf2autobot/tf2-sku';
import pluralize from 'pluralize';
import * as timersPromises from 'timers/promises';
import { Message as DiscordMessage } from 'discord.js';
import { removeLinkProtocol } from '../functions/utils';
import CommandParser from '../../CommandParser';
import Bot from '../../Bot';
Expand Down Expand Up @@ -195,7 +196,7 @@ export default class MiscCommands {
reply += custom
? custom.replace(/%stocklist%/g, stock.join(', \n'))
: `${
isWithSomething ? '\n\n' : '/pre '
isWithSomething ? '\n\n' : steamID.redirectAnswerTo instanceof DiscordMessage ? '/pre2' : '/pre '
}📜 Here's a list of all the items that I have in my inventory:\n${stock.join(', \n')}`;

if (left > 0) {
Expand Down
6 changes: 6 additions & 0 deletions src/classes/DiscordBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default class DiscordBot {
return; // don't talk to myself
}

if (message.webhookId) {
return; // Ignore webhook messages
}

log.info(
`Got new message ${String(message.content)} from ${message.author.tag} (${String(message.author.id)})`
);
Expand Down Expand Up @@ -81,6 +85,8 @@ export default class DiscordBot {
private static reformat(message: string): string {
if (message.startsWith('/code')) {
return '```json\n' + message.slice(6) + '\n```';
} else if (message.startsWith('/pre2')) {
return '```\n' + message.slice(5) + '\n```';
} else if (message.startsWith('/pre')) {
return '>>> ' + message.slice(5);
} else {
Expand Down