Skip to content

Commit

Permalink
feat(status): add bot code display
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 13, 2021
1 parent c539454 commit ee112cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-status/client/components/bot-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<tr>
<th>平台名</th>
<th>用户名</th>
<th>运行状态</th>
<th>当前消息频率</th>
<th>近期消息频率</th>
</tr>
<tr v-for="(bot, index) in status.bots" :key="index">
<td>{{ bot.platform }}</td>
<td>{{ bot.username }}</td>
<td>{{ codes[bot.code] }}</td>
<td>发送 {{ bot.currentRate[0] }}/min,接收 {{ bot.currentRate[1] }}/min</td>
<td>发送 {{ bot.recentRate[0] }}/min,接收 {{ bot.recentRate[1] }}/min</td>
</tr>
Expand All @@ -25,6 +27,8 @@ import { defineProps } from 'vue'
defineProps<{ status: Payload }>()
const codes = ['运行中', '闲置', '离线', '网络异常', '服务器异常', '封禁中', '尝试连接']
</script>

<style lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-status/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export function extend(callback: StatusCallback) {

extend(async function (status) {
if (!this.database) return
Object.assign(status, this.database.getActiveData())
Object.assign(status, await this.database.getActiveData())
})

const defaultConfig: Config = {
refresh: Time.minute,
// eslint-disable-next-line no-template-curly-in-string
formatBot: '{{ username }}:{{ code ? `无法连接` : `工作中(${rate}/min)` }}',
formatBot: '{{ username }}:{{ code ? `无法连接` : `工作中(${currentRate[0]}/min)` }}',
format: [
'{{ bots }}',
'==========',
Expand Down

0 comments on commit ee112cf

Please sign in to comment.