tree-wide: code clean-up ...

* remove commented-out code blocks
* remove usages of deprecated JS functions
This commit is contained in:
liushuyu 2022-11-05 16:14:10 -06:00
parent 0c3a42e5c7
commit cbfea20517
4 changed files with 4 additions and 6 deletions

View File

@ -70,7 +70,7 @@ export async function command(message: discord.Message) {
}
}
const game = message.content.substr(message.content.indexOf(' ') + 1);
const game = message.content.substring(message.content.indexOf(' ') + 1);
// Search all games. This is only linear time, so /shrug?
let bestGame: IGameDBEntry | null = null;

View File

@ -4,7 +4,7 @@ export const roles = ['Admins', 'Moderators'];
export async function command (message: discord.Message, reply: string | undefined) {
let replyMessage;
if (reply == null) {
replyMessage = message.content.substr(message.content.indexOf(' ') + 1);
replyMessage = message.content.substring(message.content.indexOf(' ') + 1);
} else {
replyMessage = `${message.mentions.users.map(user => `${user.toString()}`).join(' ')} ${reply}`;
}

View File

@ -8,7 +8,7 @@ const repo = process.env.GITHUB_REPOSITORY || 'citra-emu/citra';
export const roles = ['Admins', 'Moderators', 'Developer'];
export async function command(message: discord.Message) {
const prNumber = message.content.substr(message.content.indexOf(' ') + 1).replace(/\n/g, '');
const prNumber = message.content.substring(message.content.indexOf(' ') + 1).replace(/\n/g, '');
const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
return fetch(url, fetchOptions).then(response => response.json()).then((pr: any) => {
if (!pr || pr.documentation_url || !pr.head) throw new Error('PR not found');

View File

@ -140,9 +140,7 @@ client.on('messageCreate', async (message) => {
if (message.author.bot && message.content.startsWith('.ban') === false) { return; }
if (message.guild == null && state.responses.pmReply) {
// We want to log PM attempts.
// logger.info(`${message.author.username} ${message.author} [PM]: ${message.content}`);
// state.logChannel.send(`${message.author.toString()} [PM]: ${message.content}`);
// We want to reply to PM attempts.
await message.reply(state.responses.pmReply);
return;
}