emoji
This commit is contained in:
parent
a8c19c624a
commit
4f6b0ccf6b
9 changed files with 132 additions and 6 deletions
|
|
@ -196,11 +196,26 @@ export class MiMeta {
|
|||
})
|
||||
public enableRecaptcha: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public DiscordWebhookUrl: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public EmojiBotToken: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public recaptchaSiteKey: string | null;
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public ApiBase: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { DI } from '@/di-symbols.js';
|
|||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
|
||||
|
|
@ -46,12 +46,12 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
constructor(
|
||||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
private metaService: MetaService,
|
||||
private customEmojiService: CustomEmojiService,
|
||||
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
|
|
@ -71,6 +71,41 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
localOnly: ps.localOnly ?? false,
|
||||
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
|
||||
});
|
||||
const {ApiBase,EmojiBotToken,DiscordWebhookUrl} = (await this.metaService.fetch())
|
||||
const data_disc = {"username": "絵文字追加通知ちゃん",
|
||||
'content':
|
||||
'絵文字名 : :'+ ps.name +':\n' +
|
||||
'カテゴリ : ' + ps.category + '\n'+
|
||||
'ライセンス : '+ ps.license + '\n'+
|
||||
'タグ : '+ps.aliases+ '\n'+
|
||||
'追加したユーザー : ' + '@'+me.username + '\n'
|
||||
}
|
||||
|
||||
const data_Miss = {
|
||||
'i': EmojiBotToken,
|
||||
'text':
|
||||
'絵文字名 : :' + ps.name + ':\n' +
|
||||
'カテゴリ : ' + ps.category + '\n' +
|
||||
'ライセンス : ' + ps.license + '\n' +
|
||||
'タグ : ' + ps.aliases + '\n' +
|
||||
'追加したユーザー : ' + '@' + me.username + '\n'
|
||||
};
|
||||
|
||||
await fetch(ApiBase+'/notes/create', {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body:JSON.stringify( data_Miss)
|
||||
})
|
||||
|
||||
await fetch(DiscordWebhookUrl, {
|
||||
'method':'post',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data_disc),
|
||||
})
|
||||
|
||||
return {
|
||||
id: emoji.id,
|
||||
|
|
|
|||
|
|
@ -311,6 +311,10 @@ export const meta = {
|
|||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
DiscordWebhookUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
|
@ -424,6 +428,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
DiscordWebhookUrl: instance.DiscordWebhookUrl,
|
||||
EmojiBotToken: instance.EmojiBotToken,
|
||||
ApiBase: instance.ApiBase
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ export const paramDef = {
|
|||
},
|
||||
},
|
||||
summalyProxy: { type: 'string', nullable: true },
|
||||
DiscordWebhookUrl:{ type: 'string', nullable: true},
|
||||
deeplAuthKey: { type: 'string', nullable: true },
|
||||
deeplIsPro: { type: 'boolean' },
|
||||
enableEmail: { type: 'boolean' },
|
||||
|
|
@ -132,6 +133,8 @@ export const paramDef = {
|
|||
type: 'string',
|
||||
},
|
||||
},
|
||||
EmojiBotToken:{ type: 'string', nullable: true},
|
||||
ApiBase:{ type: 'string',nullable:true}
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
|
|
@ -175,7 +178,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (ps.themeColor !== undefined) {
|
||||
set.themeColor = ps.themeColor;
|
||||
}
|
||||
|
||||
if (ps.DiscordWebhookUrl !== undefined){
|
||||
set.DiscordWebhookUrl = ps.DiscordWebhookUrl
|
||||
}
|
||||
if (ps.EmojiBotToken !== undefined){
|
||||
set.EmojiBotToken = ps.EmojiBotToken
|
||||
}
|
||||
if (ps.ApiBase !== undefined){
|
||||
set.ApiBase = ps.ApiBase
|
||||
}
|
||||
if (ps.mascotImageUrl !== undefined) {
|
||||
set.mascotImageUrl = ps.mascotImageUrl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue