-
Notifications
You must be signed in to change notification settings - Fork 17
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
Auto Spoopy piece #295
Open
BenSegal855
wants to merge
9
commits into
ud-cis-discord:dev
Choose a base branch
from
BenSegal855:feat/autoSpoop
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Auto Spoopy piece #295
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a6bd3f5
feat: allow bot to be owned by a user or a team
BenSegal855 6dac2a7
fix: remove unused import
BenSegal855 5111669
feat: auto spook piece
BenSegal855 7a389b5
fix: corrected autoSpook dates
BenSegal855 4d957ca
tweak: moved autoSpoop logs to serverlog
BenSegal855 69d9fcd
Update src/sage.ts
BenSegal855 a5635b8
fix: autoSpoop schedules again
BenSegal855 a0bab3f
Merge branch 'feat/autoSpoop' of https://github.com/BenSegal855/SageV…
BenSegal855 4e922a5
tweak: removed unnecessary comment
BenSegal855 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { GUILDS } from '@root/config'; | ||
import { Client } from 'discord.js'; | ||
import { schedule } from 'node-cron'; | ||
import { SpookyError } from '@lib/types/errors'; | ||
|
||
async function register(bot: Client): Promise<void> { | ||
// Runs of the first of October at midnight | ||
schedule('0 0 1 10 *', () => { | ||
enableSpook(bot) | ||
.catch(async error => bot.emit('error', error)); | ||
}); | ||
|
||
// Runs on the first of November at midnight | ||
schedule('0 0 1 11 *', () => { | ||
disableSpook(bot) | ||
.catch(async error => bot.emit('error', error)); | ||
}); | ||
} | ||
|
||
async function enableSpook(bot:Client) { | ||
const guild = bot.guilds.cache.get(GUILDS.MAIN); | ||
|
||
await guild.setIcon(`${__dirname}/../../../assets/images/spoopylogo.png`, 'Spoopifying the server.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is how they do it everywhere else but I still cry every time I see it |
||
|
||
bot.emit('error', new SpookyError('Spoopified the server')); | ||
} | ||
|
||
async function disableSpook(bot:Client) { | ||
const guild = bot.guilds.cache.get(GUILDS.MAIN); | ||
|
||
await guild.setIcon(`${__dirname}/../../../assets/images/cisc-logo.png`, 'Spoopifying the server.'); | ||
|
||
bot.emit('error', new SpookyError('Un-spoopified the server')); | ||
BenSegal855 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
export default register; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Petition to make this say
Boo!
andUn-boo!
when you spoopify and unspoopify respectively