Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
slayernominee committed Jun 9, 2023
1 parent 6b18b8b commit 7940f74
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Binary file modified .github/showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion pages/channel/[server]/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const messageSend = async (message: string) => {
message_key.value++
}
const members: any = []
const { members }: any = await $fetch('/api/allMembersByRoles', { method: 'POST', body: { guild_id: server_id } })
console.log(members)
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export default defineEventHandler(async (event) => {
const { guild_id } = await readBody(event)
const { roles } = await $fetch('/api/roles', { method: 'POST', body: { guild_id: guild_id } })


const { members } = await $fetch('/api/members', { method: 'POST', body: { guild_id: guild_id } })

// TODO: option to give the roles and the users -> less requests
Expand Down
Empty file removed server/api/channelMembers.js
Empty file.
13 changes: 13 additions & 0 deletions server/api/member.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { REST } from '@discordjs/rest'
import { Routes } from 'discord-api-types/v10'

const rest = new REST({ version: '10' }).setToken(`${useRuntimeConfig().token}`)

export default defineEventHandler(async (event) => {
const { guild_id, user_id } = await readBody(event)
const member = await rest.get(Routes.guildMember(guild_id, user_id))

return {
member: member
}
})
3 changes: 2 additions & 1 deletion server/api/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const rest = new REST({ version: '10' }).setToken(`${useRuntimeConfig().token}`)

export default defineEventHandler(async (event) => {
const { guild_id } = await readBody(event)
const members = await rest.get(Routes.guildMembers(guild_id), { query: "limit=30"})

const members = await rest.get(Routes.guildMembers(guild_id), { query: "limit=100"})

return {
members: members
Expand Down

0 comments on commit 7940f74

Please sign in to comment.