Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
ba86209
FIXED: partnering algorithm, joining, starting, partnering PMs; ADDED…
avchikar97 Nov 17, 2018
9998d19
Added ping-pong
avchikar97 Nov 17, 2018
f860a85
adding pause, end; revising stop_bot
avc536 Nov 17, 2018
54eedb5
undid heroku portion of previous commit
avc536 Nov 17, 2018
c63ca15
quality of life
avc536 Nov 17, 2018
701ad61
so master can merge into heroku just fine
avchikar97 Nov 17, 2018
c3023c0
Changed prefix, DM commands allowed
avc536 Nov 17, 2018
c3c5390
removed shutdown command
avc536 Nov 17, 2018
753537a
code cleanup
avc536 Nov 18, 2018
0ea7068
checks if user left during pause
avc536 Nov 18, 2018
9b55fab
better command not found, some cleanup
avc536 Nov 18, 2018
917bdc2
Merge pull request #2 from avchikar97/dev
avchikar97 Nov 18, 2018
75948b8
Easier data indexing, adding requirements.txt to tree
avchikar97 Nov 18, 2018
e79b6b9
added requirements.txt
avchikar97 Nov 18, 2018
8c18a55
Merge pull request #3 from avchikar97/dev
avchikar97 Nov 18, 2018
5e0e9a8
fixed data indexing
avchikar97 Nov 19, 2018
f0e80e0
Fixed issue: cannot s\!end and s\!join in succession; fine-tuned paus…
avchikar97 Nov 19, 2018
3d8ec39
Fixed issue #4: cannot s\!end and s\!join in succession; fine-tuned p…
avchikar97 Nov 19, 2018
3a52a7e
Merge branch 'dev' of https://github.com/avchikar97/SantaBot into dev
avchikar97 Nov 19, 2018
b504217
Merge pull request #5 from avchikar97/dev
avchikar97 Nov 19, 2018
3c217dc
Added playing status for help; consistent capitalization
avchikar97 Nov 19, 2018
c525824
Merge pull request #6 from avchikar97/dev
avchikar97 Nov 19, 2018
03c1dd7
changed some message strings
avc536 Nov 19, 2018
9a2594c
Merge pull request #7 from avchikar97/dev
avchikar97 Nov 19, 2018
528f697
Fixed issue #8: no more default usrlist in function calls
avchikar97 Nov 19, 2018
b049812
Merge pull request #9 from avchikar97/dev
avchikar97 Nov 19, 2018
b3ac7b4
moved message delete for wishlist and pref set in an attempt to make …
avchikar97 Nov 19, 2018
4d1f1bb
Merge pull request #10 from avchikar97/dev
avchikar97 Nov 19, 2018
94a3ce2
centralized error messages
avchikar97 Nov 20, 2018
afbe34c
Updated README
avchikar97 Nov 20, 2018
627e1d9
multiple bug fixes
avchikar97 Nov 20, 2018
bfae297
tidying up error strings
avchikar97 Nov 20, 2018
72a2bd2
Improved error checking
avchikar97 Nov 20, 2018
4238d8f
Merge pull request #11 from avchikar97/dev
avchikar97 Nov 20, 2018
7082d9e
message changes, s\!listparticipants only for admin
avchikar97 Nov 22, 2018
f92cf87
a few buf fixes, string alignments
avc536 Nov 23, 2018
01c0d2f
message changes, bot now uses token from CONFIG.py no longer saves to…
avchikar97 Nov 23, 2018
a7462a3
updated error
avchikar97 Nov 23, 2018
5a8e784
more error updates
avchikar97 Nov 23, 2018
1756442
set default wishlist and pref
avchikar97 Nov 23, 2018
429dcd6
completed incomplete function
avchikar97 Nov 23, 2018
3046ac8
more error checking
avchikar97 Nov 23, 2018
9c7ffc5
I'm being told there were changes here but I don't see them
avc536 Nov 23, 2018
5bc4ca5
something stupid with line endings
avc536 Nov 23, 2018
1f0139a
updated README
avchikar97 Nov 23, 2018
1a48bfb
Merge pull request #16 from avchikar97/dev
avchikar97 Nov 25, 2018
eff7b04
better organized file
avchikar97 Dec 3, 2018
0108a6c
cute ping message
avchikar97 Dec 3, 2018
bf05b8c
Merge pull request #17 from avchikar97/dev
avchikar97 Dec 3, 2018
b696d35
little message of who to contact
avchikar97 Dec 14, 2018
ca35e11
santa-bot runner. Honestly probably not a good idea to use this.
avchikar97 Dec 14, 2018
7796223
Merge pull request #18 from avchikar97/dev
avchikar97 Dec 14, 2018
26e2231
Shell script executable. Still probably not a good idea. You'll want …
avchikar97 Dec 14, 2018
32d135b
Merge pull request #19 from avchikar97/dev
avchikar97 Dec 14, 2018
c91240f
run script doesn't need to be in dev branch
avchikar97 Dec 17, 2018
b5e851e
reconnect
avchikar97 Jan 15, 2019
11cd359
Merge pull request #20 from avchikar97/dev
avchikar97 Jan 15, 2019
62c0c7c
Not for use in the dev branch. See comments. May not be necessary due…
avchikar97 Jan 15, 2019
5436597
Not for use in the dev branch. See comments. May not be necessary due…
avchikar97 Jan 15, 2019
73ca8af
user inputs client_id to allow user to invitee bot
avc536 Jan 16, 2019
183db3b
Merge pull request #22 from avchikar97/dev
avchikar97 Jan 16, 2019
b9ae2d2
DELETE FILE after rewrite - makes it easier to rewrite with code side…
avc536 Apr 9, 2019
198603e
exploring the rewrite
avchikar97 Apr 9, 2019
220cbcb
working branch
avchikar97 May 20, 2019
e400412
startup terminal message adjustment
avchikar97 May 20, 2019
b6a9ef4
shit
avchikar97 May 20, 2019
a99670c
shrug
avchikar97 May 20, 2019
939642e
resolved changes in #23. Changes will be integrated in final rewrite
avchikar97 May 20, 2019
4806a59
added prefix to config
avchikar97 May 21, 2019
47ae330
makes prefix stuff easier for rewrite
avchikar97 May 21, 2019
0c7ef80
#15 implemented two get/set wishlist URL - might change the command name
avchikar97 May 21, 2019
f23ea24
tiny ping fix
avchikar97 May 21, 2019
31cac10
#15 added join and invite command
avchikar97 May 21, 2019
a8fd760
got rid of an annoying warning
avchikar97 May 21, 2019
58f29e3
starting on setprefs -- //TODO: draw the rest of the owl
avchikar97 May 21, 2019
e9b554d
\#15 setprefs
avchikar97 May 29, 2019
1cf5e27
new separator for preferences and wishlist
avchikar97 May 29, 2019
de71712
help instruction for setprefs + minor fix-ups
avchikar97 May 29, 2019
e348792
\#15 getprefs
avchikar97 May 29, 2019
b39f4bf
refactor of helper functions
avchikar97 May 29, 2019
9f51a0a
refactoring
avchikar97 May 29, 2019
a41887c
#15 start
avchikar97 May 29, 2019
0890d06
more refactoring
avchikar97 May 29, 2019
2f37ce8
#15 restart
avchikar97 May 29, 2019
31f46aa
refactoring
avchikar97 May 29, 2019
6e93c78
runtime prefixes in messages
avchikar97 May 29, 2019
925238e
#15 end, listparticipants, totalparticipants
avchikar97 May 30, 2019
6f26ab1
#15 partnerinfo
avchikar97 May 30, 2019
f908f4b
TODOs
avchikar97 May 30, 2019
8ab0f4c
#15 fixed global variable issues
avchikar97 Jun 9, 2019
1872a1e
updated role hierarchy access to syntax of v1.x, added QoL function i…
avchikar97 Jun 10, 2019
0d386a3
#15 added leave
avchikar97 Jun 10, 2019
f170357
fixed leave, fixed multiple leave/join bug
avchikar97 Jun 10, 2019
6744f62
one todo, minor comment fix
avchikar97 Jun 10, 2019
8aea26d
wishlisturl get/set works
avchikar97 Jun 10, 2019
f3ef737
Line endings
avchikar97 Sep 10, 2019
75d91bd
Line endings
avchikar97 Sep 10, 2019
6e1b324
Merge branch 'rewrite' of https://github.com/avchikar97/SantaBot into…
avchikar97 Sep 10, 2019
95eb0cd
Quick and dirty mute function -- delete in later commit
avchikar97 Sep 10, 2019
c9ebbef
Quick and dirty mute function -- delete in later commit
avchikar97 Sep 10, 2019
3837a6b
Merge branch 'master' of https://github.com/avchikar97/SantaBot
avchikar97 Sep 10, 2019
6bb6bcf
#28 refactored into classes
avchikar97 Sep 23, 2019
4a58a0d
Added commit message template
avchikar97 Oct 5, 2019
23da805
Closes #29: full string representation of Participant object
avchikar97 Oct 5, 2019
e375a67
Close #29: full string representation of Participant object
avchikar97 Oct 5, 2019
95bb28a
Merge branch 'rewrite' of https://github.com/avchikar97/SantaBot into…
avchikar97 Oct 5, 2019
111c727
A few house-keeping updates
avchikar97 Nov 3, 2019
624ba10
Merge remote-tracking branch 'remotes/origin/rewrite'
avchikar97 Nov 3, 2019
7b1a73a
Reaction role assignment
avchikar97 Nov 3, 2019
7d65f68
some shit
avchikar97 Nov 3, 2019
74c494b
wrong channel ID
avchikar97 Nov 3, 2019
bbdc199
requirements.txt update
avchikar97 Nov 19, 2019
06dc19d
Function typing
avchikar97 Jan 9, 2020
18990c8
revert CONFIG.py
avchikar97 Jan 9, 2020
33a668d
Closes #15: Removed santa-bot_old.py due to rewrite completion
avchikar97 Jan 9, 2020
0cad3b5
[commit title]
avchikar97 Apr 22, 2020
758d9ab
[commit title]
avchikar97 Apr 22, 2020
760b0a0
Revert "[commit title]"
avchikar97 Apr 22, 2020
1f132a6
#31: Add command to archive pins
avchikar97 Apr 22, 2020
72ed40e
#31: Separate archiving and unpinning commands
avchikar97 Apr 22, 2020
0033b30
#31: quick edit
avchikar97 Apr 22, 2020
0314cff
#31: error shit
avchikar97 Apr 22, 2020
242f274
#31: remove f-strings to work on raspberry pi
avchikar97 Apr 23, 2020
c4834d0
#31: last error stuff for archiving
avchikar97 Apr 23, 2020
c2661d1
#31: unpin last thing
avchikar97 Apr 23, 2020
062a37f
misc
avchikar97 Apr 23, 2020
d3683cc
#31: Update unpin description
avchikar97 Apr 23, 2020
941c93b
#31: Attachment link bug
avchikar97 Apr 23, 2020
9857aad
#31: remove bad await from unpin
avchikar97 Apr 23, 2020
3c84fde
#31: last messaging tune-up
avchikar97 Apr 23, 2020
efcfe18
Merge branch 'dev' of https://github.com/avchikar97/SantaBot into dev
avchikar97 May 4, 2020
fb0cc94
#33: Begin cog re-org: set/getwishlisturl, setprefs
avchikar97 May 4, 2020
7f1bfb0
[commit title]
avchikar97 May 4, 2020
48ac51d
#33: Moved all other commands (pins, reaction roles, ping, etc.) to cogs
avchikar97 May 4, 2020
d5153c0
Sort bot errors alphabetically
avchikar97 May 4, 2020
38e34a2
Add role_channel to config
avchikar97 May 4, 2020
784f6f9
Designate reaction role channel in CONFIG
avchikar97 May 4, 2020
20a33dd
Merge pull request #35 from avchikar97/dev
avchikar97 May 4, 2020
ce8ee06
Whoops role channel needed to be lowercased everywhere else
avchikar97 May 4, 2020
faa165e
Merge pull request #36 from avchikar97/dev
avchikar97 May 4, 2020
64f1eaf
Clean up debug print
avchikar97 May 4, 2020
2dc8e14
make run_santa.sh executable
avchikar97 May 4, 2020
f100754
Update README.md
avchikar97 May 4, 2020
0dd753f
Update README.md
avchikar97 May 4, 2020
b535a80
Move on_ready listener to Administrative class
avchikar97 May 5, 2020
9c219e1
Merge branch 'master' of https://github.com/avchikar97/SantaBot
avchikar97 May 5, 2020
92bdc32
Update README.md
avchikar97 May 5, 2020
eac061d
Update README.md
avchikar97 May 5, 2020
68dac0b
Closes #25: Fill in all help commands in SecretSanta cog
avchikar97 May 13, 2020
e557109
Merge branch 'master' of https://github.com/avchikar97/SantaBot
avchikar97 May 13, 2020
61f1b55
Merge pull request #40 from avchikar97/master
avchikar97 May 15, 2020
cd5a749
Modify CONFIG.py to work on any system
avchikar97 May 15, 2020
9449f58
#41: Implement countdown timer command
avchikar97 May 17, 2020
559729b
Bound pin archive channel lookup by the context
avchikar97 May 17, 2020
42c4cbd
Add countdown argument help
avchikar97 May 17, 2020
17eae79
Clean up countdown, use TextChannelConverters
avchikar97 May 20, 2020
533751d
Fix up role channel assignment
avchikar97 May 20, 2020
18dbc6f
#41 reduce the number of re-written check strings
avchikar97 May 21, 2020
cfa8225
#41 add safety to countdown remove and set
avchikar97 May 21, 2020
9cbed6e
Merge pull request #42 from avchikar97/dev
avchikar97 May 21, 2020
64a5ddd
#41 last usage guide help
avchikar97 May 21, 2020
bb12c1c
#41 clarify help countdown help command
avchikar97 May 21, 2020
246bc38
#41 modify countdown set feedback message
avchikar97 May 21, 2020
231acd5
#41 use common function for the diff string
avchikar97 May 21, 2020
6e3daa1
borked the role channel when I used the converter for assign_role_cha…
avchikar97 May 21, 2020
f42a472
removed unnecessary get_channel call
avchikar97 May 21, 2020
cbe6425
Keep back pendulum
avchikar97 May 23, 2020
11d2695
Update SantaAdministrative.py
avchikar97 May 27, 2020
baddd69
Merge pull request #43 from avchikar97/master
avchikar97 May 29, 2020
a6d3b9d
Switch constants to enum
avchikar97 May 29, 2020
0e58a49
Create Utilities cog, slim cogs to just commands.stuff
avchikar97 May 29, 2020
2967e13
pathlib on unix returns a PosixPath for some reason instead of str
avchikar97 May 29, 2020
2f69ecd
Tell the user their countdown options
avchikar97 May 29, 2020
29f80e0
Command to generate emote URLs for ~~stealing~~ inspiration
avchikar97 May 29, 2020
4199cd7
Move logger to santabot main function
avchikar97 May 31, 2020
182dc2d
Merge pull request #44 from avchikar97/dev
avchikar97 May 31, 2020
2565883
Make variable names a little clearer
avchikar97 Jun 3, 2020
a83ae17
Save a few computations in possible with rxn roles
avchikar97 Jun 3, 2020
779d821
Closes #45: Open the url to find the appropriate emote extension
avchikar97 Jun 5, 2020
fc1fc67
Remove beautifulsoup import from Utilities
avchikar97 Jun 5, 2020
2715ed9
Merge pull request #46 from avchikar97/dev
avchikar97 Jun 5, 2020
13a38d7
Make the CD date format a bit easier
avchikar97 Jun 9, 2020
d376fc6
Update README.md
avchikar97 Jun 11, 2020
af2018a
Closes #26: Use f-strings since raspberry pi has python 3.7.3 now
avchikar97 Jun 12, 2020
e86efb3
[commit title]
avchikar97 Jun 12, 2020
7690f40
Update pendulum
avchikar97 Jun 14, 2020
496e836
Make unique SantaBot countdown tables for each guild
avchikar97 Jun 28, 2020
2f96c50
Putting the f in f-string
avchikar97 Jul 14, 2020
9f3da1e
Update requirements.txt
avchikar97 Oct 7, 2020
6d2c76c
#49 use IntEnum for SecretSantaConstants, fix copy-paste errors, add …
avchikar97 Nov 1, 2020
0a5321f
#49 fix messed up character literal, configobj not found doesn't need…
avchikar97 Nov 1, 2020
c6d5956
Create CONFIG.py.example
avchikar97 Nov 5, 2020
0d624b5
Update README.md
avchikar97 Nov 5, 2020
ef4a742
Update README.md
avchikar97 Nov 5, 2020
85ebb03
#51 fix listparticipants not printing the participants
avchikar97 Nov 20, 2020
a5dfcf6
Be consistent with SecretSanta command aliases
avchikar97 Nov 20, 2020
44acf06
Update README.md
avchikar97 Nov 20, 2020
5cb0946
Update README.md
avchikar97 Nov 20, 2020
4f7213c
Update README.md
avchikar97 Nov 20, 2020
ae0a6e3
Update README.md
avchikar97 Nov 20, 2020
90974c9
santabot.service
irnutsmurt Nov 22, 2020
e3b8d26
Fixed Readme for SystemD Service SantaBot
irnutsmurt Nov 22, 2020
f80f8d0
Merge pull request #54 from irnutsmurt/master
avchikar97 Nov 22, 2020
cd23f2f
Address #52 by adding more specific user prompts and setting preferen…
avchikar97 Nov 22, 2020
767179b
Add Intents in order to get server members
avchikar97 Nov 22, 2020
c5e8951
Update README.md
avchikar97 Nov 22, 2020
47d3da0
#55 fix get_participant_object not working
avchikar97 Nov 23, 2020
898d587
Add context (guild, DM) check for commands, unrestrict listparticipants
avchikar97 Nov 25, 2020
152fc1e
#56 add partner/secret santa DMs
avchikar97 Nov 25, 2020
5838446
Magic bug fix I guess
avchikar97 Nov 25, 2020
21e30c2
s!start bug patch 1
avchikar97 Nov 26, 2020
554a269
Closes #58 add logging along with helper functions in BOT_ERROR.py to…
avchikar97 Nov 26, 2020
1e09303
#52 only updated CONFIG.py.example and the README but not the actual …
avchikar97 Nov 26, 2020
873b837
#58 forgot one logger parameter
avchikar97 Nov 26, 2020
e7cf6c6
Added missing details for systemd
irnutsmurt Dec 1, 2020
928c9bf
Merge branch 'master' into master
avchikar97 Dec 1, 2020
b4f37a3
Merge pull request #59 from irnutsmurt/master
avchikar97 Dec 1, 2020
c950ad3
#56 add confirmation message for SS DMs
avchikar97 Dec 1, 2020
a8020aa
Make emote roles a little more robust
avchikar97 Jan 8, 2021
4d7fc41
Use discord.PartialEmoji instead of urllib3 for emote urls
avchikar97 Jan 8, 2021
d919058
Don't check crossed-out lines, use PartialEmoji
avchikar97 Jan 19, 2021
5580a2b
Update requirements.txt
avchikar97 Jul 21, 2024
18781ce
Merge pull request #60 from avchikar97/avchikar97-patch-1
avchikar97 Jul 21, 2024
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
152 changes: 148 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,148 @@
*.log
*.cfg
/.vscode
.pylintrc
*.log
*.cfg
*.sqlite
/.vscode
.pylintrc
/__pycache__
Procfile
*.code-workspace


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
10 changes: 10 additions & 0 deletions .gitmessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[commit title]

#<issueNum>: [commit title]

Closes #<issueNum>: [commit title]

<ChangeDetails>
<ChangeDescription>description</ChangeDescription>
<ChangeReasoning>reasoning</ChangeReasoning>
</ChangeDetails>
21 changes: 21 additions & 0 deletions CONFIG.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import pathlib

discord_token = "YOUR_TOKEN_HERE"
client_id = "YOUR_CLIENT_ID"
prefix = "YOUR_PREFIX_HERE"
bot_folder = "YOUR_STORAGE_FOLDER_NAME_HERE"
cfg_name = "botdata.cfg"
sqlite_name = "santabotdb.sqlite"
dbg_name = "debug.log"
role_channel = -1
min_budget = 10
max_budget = 20


###############################################
### DO NOT CHANGE BELOW ###
###############################################
cfg_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, cfg_name)
sqlite_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, sqlite_name)
dbg_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, dbg_name)
21 changes: 21 additions & 0 deletions CONFIG.py.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import pathlib

discord_token = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890"
client_id = "0123456789"
prefix = "s!"
bot_folder = "files"
cfg_name = "botdata_example.cfg"
sqlite_name = "santabotdb_example.sqlite"
dbg_name = "debug_example.log"
role_channel = 9876543210
min_budget = 10
max_budget = 20


###############################################
### DO NOT CHANGE BELOW ###
###############################################
cfg_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, cfg_name)
sqlite_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, sqlite_name)
dbg_path = os.path.join(str(pathlib.Path(__file__).parent), bot_folder, dbg_name)
130 changes: 115 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,123 @@
#SantaBot
# SantaBot

A Discord bot to organize secret santa gift exchanges using the discord.py Python library
A Discord bot to organize secret santa gift exchanges using the discord.py Python library + some other admin-type stuff for my server

##Instructions:
- This bot code must be pulled (or forked) and run locally
- If you don't want the admin-type stuff, just go in and comment out the add_cog(SantaAdministrative(...)) line

###Installation and Dependencies:
### Requirements
- python 3.6 or later (can be installed [here](https://www.python.org/downloads/))
- pip3

To add this bot to your Discord server, first ensure you have [Python version 3.5 or later installed](https://www.python.org/downloads/), along with [the discord.py library](https://github.com/Rapptz/discord.py) and [the configobj library](https://www.voidspace.org.uk/python/configobj.html#downloading). The asyncio, logging, os.path, and random libraries are also required, but they should be included in most Python installations by default.
### Steps to run:
1. Run `pip3 install -r requirements.txt`
2. Once all of the dependencies are installed, create a Discord bot token following the instructions [here](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token).
- **IMPORTANT:** you will need to explicitly enable the Server Members Intent under the Bot tab in the [Discord Application Developer Portal](https://discord.com/developers/applications/) ![as pictured](https://i.imgur.com/mvwTiPE.png)
3. Replace variables in CONFIG.py (I have provided CONFIG.py.example as an example)

Once all of the dependencies are installed, create a Discord bot token following the instructions [here](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token). Then, open the santa-bot.py file with your favorite plaintext editor, and replace the word `'token'` in the last line that reads `client.run('token')` with the token you have generated, keeping the single quotes. The santa-bot.py file can now be excecuted, and the bot should function as normal.
3a. Replace `discord_token` and `client_id` in CONFIG.py with your bot token - these two are REQUIRED for all functionality and for the bot to even start

###Bot Commands:
3b. Replace other variables as you want

- `$$join` adds you to the list of secret santa participants.
- `$$setaddress` saves your mailing address for gifts to be sent to.
- `$$setprefs` saves your gift preferences so your secret santa will know what kind of things you would like to receive. Keep in mind that your exact input is sent to your secret santa as is.
- `$$listparticipants` makes the bot list all of the people currently participating in the secret santa exchange.
- `$$totalparticipants` makes the bot give the number of people currently participating in the secret santa exchange
- *`$$start` to have the bot assign each participant a partner
- *`$$shutdown` to make the bot self-terminate
- `role_channel` is REQUIRED for using reaction roles - will print an error in the console if left as -1

all commands marked with a * can only be run by a server admin.
- `prefix` change it to whatever you want otherwise commands default to YOUR_PREFIX_HEREjoin, YOUR_PREFIX_HEREunpin_all, etc.

- `bot_folder` this is where the .cfg for the Secret Santa participants, the debug log, and the SQLite database files are stored

- `cfg_name`, `dbg_name`, `sqlite_name` don't *need* to do anything here unless you want to

- `min_budget`, `max_budget` are used for the Secret Santa functionality and can be changed depending on what your Discord server agrees upon.
4. Run `python3 santa-bot.py`

### Add a Systemd Service for SantaBot to Autostart on Reboot
To keep SantaBot running even after restart you can create a service.

1. Copy the `run_santa.sh` to `/usr/local/bin/` directory

- sudo cp run_santa.sh /usr/local/bin/

2. Edit `run_santa.sh` in `/usr/local/bin` with your favorite editor to include the absolute path to the santa-bot.py script. For example `/home/pi/Santabot/santa-bot.py`. If you're not sure the absolute, in the Santabot directory type `pwd`

- pwd
/home/pi/Santabot
- sudo nano /usr/local/bin/run_santa.sh

- while true
- do
- python3 /home/pi/Santabot/santa-bot.py
- sleep 10
- done


3. Create a service file or edit the included `santabot.service` using your favorite text editor and add the default user name to `User=` and the Group they belong to in `Group=`. To find out what default group a user belongs use `id -gn usernamehere`

- nano santabot.service

- [Unit]
- Description=Santa Discord Bot

- [Service]
- User= root
- Group= root
- Restart=on-abort
- WorkingDirectory= "Full Path to Santa Bot Here"
- ExecStart= /usr/local/bin/run_santa.sh

- [Install]
- WantedBy=multi-user.target

4. Copy the santabot.service to `/lib/systemd/system/`

- sudo cp santabot.service /lib/systemd/system/

5. Enable the service so it will autostart on reboot, then start with the commands:

- sudo systemctl enable santabot.service
- sudo systemctl start santabot.service

6. Then check the status

- sudo systemctl status santabot.service

7. When done using the bot for the season, to disable use both commands:

- sudo systemctl disable santabot.service
- sudo systemctl stop santabot.service

#### FAQ:
1. What if my wishlist URL or preference is multiple words?
- The bot supports that, just surround it with quotation marks. (e.g. `s!setprefs dog "stuffed rabbit" cat`)
2. Does the wishlist *have* to be a URL? What if one of the Secret Santas prefers sending handmade gifts?
- No that field is really about having a destination for users to send their gifts. Feel free to use addresses instead of URLs if you so desire. Keep in mind that addresses will need to follow question #1 of this FAQ (e.g. `s!setwishlisturl amazonurl/123 "P Sherman 42 Wallaby Way" rightstufanime`)

#### Secret Santa Commands:

- `s!join` = join the Secret Santa
- `s!leave` = leave the Secret Santa
- `s![setwishlisturl|swlurl] [wishlist URL]` = set your wishlist URL (replaces current). You may also add your mailing address. __wishlist URL is required__.
- `s![getwishlisturl|gwlurl]` = bot will PM you your current wishlist
- `s![setprefs|sprefs] [specific preferences, the things you like]` = set preferences (replaces current). Put N/A if none. __preferences are required__.
- `s![getprefs|gprefs]` = bot will PM you your current preferences
- `s![listparticipants|lp]` **(admin only)** = get the current participants
- `s![totalparticipants|tp]` = get the total number of participants
- `s!partnerinfo` = be DM'd your partner's information
- `s!start` **(admin only)** = assign Secret Santa partners
- `s!restart` **(admin only)** = attempt to restart Secret Santa after pause without changing partners
- `s!pause` **(admin only)** = pause Secret Santa (will require `s!start` and will reshuffle partners)
- `s!end` **(admin only)** = end Secret Santa

#### Administrative Commands:
- `s!assign_role_channel CHANNEL` **(admin only)** = change the channel the bot looks at for reaction roles
- `s!archive_pins SRC_CHANNEL DEST_CHANNEL` **(admin only)** = archive all pins from the source channel to the destination channel as messages (ex. `s!archive_pins #general #archive`)
- `s!unpin_all [CHANNEL_ID]` **(admin only)** = unpin all messages in the indicated channel (defaults to the channel the command is called in)

#### Utility Commands:
- `s!emote [any number of emotes]` = returns the URL of the emote image/gif for convenience
- `s![countdown|cd]` = set/check a countdown (global for the server, e.g. time until a Manga Club event) - help text is returns as needed

#### Miscellaneous Commands:

- `s!ping` = check if bot is alive
- `s!echo` = make the bot say stuff
- `s!ding` = dong
Loading