mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add ability to use discord info for tweet
This commit is contained in:
@@ -292,7 +292,25 @@ module.exports = class TweetCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchUser(user) {
|
async fetchUser(user) {
|
||||||
|
if (user === 'me') {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
|
const matches = val.match(/^(?:<@!?)?([0-9]+)>?$/);
|
||||||
|
if (matches) {
|
||||||
|
const user = await this.client.users.fetch(matches[1]);
|
||||||
|
if (!user) throw new Error('User not found');
|
||||||
|
const avaURL = user.displayAvatarURL({ extension: 'png', size: 64, forceStatic: true });
|
||||||
|
const avatarRes = await request.get(avaURL);
|
||||||
|
return {
|
||||||
|
screenName: user.username,
|
||||||
|
name: user.globalName || user.username,
|
||||||
|
avatar: avatarRes.body,
|
||||||
|
avatarShape: 'Circle',
|
||||||
|
checkType: null,
|
||||||
|
label: null,
|
||||||
|
followers: 5
|
||||||
|
};
|
||||||
|
}
|
||||||
const guestClient = await api.getGuestClient();
|
const guestClient = await api.getGuestClient();
|
||||||
const { data } = await guestClient.getUserApi().getUserByScreenName({ screenName: user });
|
const { data } = await guestClient.getUserApi().getUserByScreenName({ screenName: user });
|
||||||
const body = data.user.legacy;
|
const body = data.user.legacy;
|
||||||
|
|||||||
Reference in New Issue
Block a user