mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -41,7 +41,7 @@ module.exports = class TweetCommand extends Command {
|
|||||||
{
|
{
|
||||||
key: 'user',
|
key: 'user',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 20
|
max: 25
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'text',
|
key: 'text',
|
||||||
@@ -292,18 +292,16 @@ module.exports = class TweetCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchUser(user) {
|
async fetchUser(user) {
|
||||||
if (user === 'me') {
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const matches = val.match(/^(?:<@!?)?([0-9]+)>?$/);
|
const matches = user.match(/^(?:<@!?)?([0-9]+)>?$/);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const user = await this.client.users.fetch(matches[1]);
|
const found = await this.client.users.fetch(matches[1]);
|
||||||
if (!user) throw new Error('User not found');
|
if (!found) throw new Error('User not found');
|
||||||
const avaURL = user.displayAvatarURL({ extension: 'png', size: 64, forceStatic: true });
|
const avaURL = found.displayAvatarURL({ extension: 'png', size: 64, forceStatic: true });
|
||||||
const avatarRes = await request.get(avaURL);
|
const avatarRes = await request.get(avaURL);
|
||||||
return {
|
return {
|
||||||
screenName: user.username,
|
screenName: found.username,
|
||||||
name: user.globalName || user.username,
|
name: found.globalName || found.username,
|
||||||
avatar: avatarRes.body,
|
avatar: avatarRes.body,
|
||||||
avatarShape: 'Circle',
|
avatarShape: 'Circle',
|
||||||
checkType: null,
|
checkType: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user