Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Twitch stream announcement integration #113

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
1. Run `npm install`
2. Set env `GITHUB_TOKEN` to your personal GitHub API token
3. Set env `DISCORD_TOKEN` to your Discord bot token
4. Set env `TWITCH_CLIENT_ID` to your Twitch Application Client ID
5. Set env `TWITCH_CLIENT_SECRET` to your Twitch Application Client Secret
5. (optional) Set env `LOG_LEVEL` to `debug` if you want debug logging
6. Run `node lib/app.js` (or without LOG_LEVEL to default to 'info')
4. (optional) Set env `LOG_LEVEL` to `debug` if you want debug logging
5. Run `node lib/app.js` (or without LOG_LEVEL to default to 'info')

![preview](https://i.imgur.com/45plIKX.png)
20 changes: 0 additions & 20 deletions lib/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import fetch from 'node-fetch'
import { Client, Intents } from 'discord.js'
import { log, fetchAuditEntryFor, limitStrTo } from './common.js'
import { updateStream, updateStreams } from './twitch.js'
import { fetchAllContributors } from './contributors.js'
import { fetchBlocked } from './blocked.js'
import { cleanup, processModMail, processModMailReply, processModMailTyping } from './modmail.js'
Expand Down Expand Up @@ -68,7 +67,6 @@ client.on('ready', () => {
scheduleWithFixedDelay(() => resetMessageCache(), 30 * 60000)
scheduleWithFixedDelay(() => pruneDeletedMessages(), 10_000)
scheduleWithFixedDelay(() => pruneRecentlyFlagged(), 5 * 60000)
scheduleWithFixedDelay(() => updateStreams(client.channels), 5 * 60000)
scheduleWithFixedDelay(() => notice.cleanup(), 30_000)
scheduleWithFixedDelay(() => cleanup(), 30_000)
})
Expand Down Expand Up @@ -177,11 +175,6 @@ client.on('messageCreate', async message => {

await addCommand(client.user.id, message.guild, createCommand(name, value))
return message.channel.send(`Successfully added command \`${name}\``)
} else if (command === 'stream') {
const value = args.join(' ').toLowerCase().trim()
updateStream(message.member, value)
updateStreams(client.channels)
return message.channel.send(value ? `Successfully added stream \`${value}\`` : 'Successfully removed stream')
} else if (command === 'cfpurge') {
const arg = args.shift()
if (!arg) {
Expand Down Expand Up @@ -280,19 +273,6 @@ function onMessageEdit (oldMessage, newMessage) {
logs.send(withoutMentions(`:pencil: ${buildUserDetail(user)}'s message was modified: ${messageDetail}`))
}

client.on('presenceUpdate', (oldPresence, newPresence) => {
const newMember = newPresence.member

if (!newMember || !newMember.roles.cache.some(r => r.name.toLowerCase() === config.roles.streams.toLowerCase())) {
return
}

const activity = newPresence.activities && newPresence.activities.find(p => p.type === 'STREAMING')
const url = activity && activity.url

updateStream(newMember, url)
})

client.on('guildBanAdd', async (guildBan) => {
const guild = guildBan.guild
const user = guildBan.user
Expand Down
7 changes: 0 additions & 7 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export default {
githubToken: process.env.GITHUB_TOKEN,
// This is token used for bot to login, must be from Discord Application who has bot enabled
discordToken: process.env.DISCORD_TOKEN,
// Used for getting information about streamer from Twitch API
twitchClientId: process.env.TWITCH_CLIENT_ID,
twitchClientSecret: process.env.TWITCH_CLIENT_SECRET,
// Discord Application ID for RuneLite
discordAppID: '409416265891971072',
// Bad IDs to flag
Expand All @@ -43,8 +40,6 @@ export default {
channels: {
// Name of Discord channels where custom commands will be ignored
noCustomCommands: ['development'],
// Name of Discord channel where streamers will be announced
streams: 'twitch',
// Name of Discord channel where moderation logs will be sent (user ban/unban, user role change)
moderationLogs: 'mod-logs',
// Name of Discord channel where server logs will be sent (user join/leave)
Expand Down Expand Up @@ -79,8 +74,6 @@ export default {
],
// Name of Discord role that will be used to mute people
muted: 'muted',
// Name of Discord role that will be used to check if user can be announced in streamer channel
streams: 'streamer',
// Name of Discord role that will be given to users authed via GitHub
verified: 'github-verified',
// Name of Discord role that will be given to users that contributed to main github repo
Expand Down
126 changes: 0 additions & 126 deletions lib/twitch.js

This file was deleted.

Loading