mirror of
https://github.com/AsgardEternal/DiscordWhitelist.git
synced 2025-01-02 09:49:13 -06:00
Added example for pulling discord token from environment variable and setup init run config
This commit is contained in:
parent
087a01364e
commit
1db238244b
10
.idea/DiscordWhitelist.iml
Normal file
10
.idea/DiscordWhitelist.iml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (DiscordWhitelist)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/DiscordWhitelist.iml" filepath="$PROJECT_DIR$/.idea/DiscordWhitelist.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,2 +1,19 @@
|
||||
import os
|
||||
import discord
|
||||
|
||||
|
||||
# run init stuff inside this function
|
||||
def init():
|
||||
# make sure this prints the discord token
|
||||
# set this up as a runtime environment variable, DO NOT HARDCODE THE TOKEN
|
||||
try:
|
||||
disToken = os.environ[
|
||||
'DISCORD_TOKEN'] # grabs the discord token from the environment variable, if not there, exit
|
||||
except:
|
||||
print("ERROR: unable to find discord token in environment variables!")
|
||||
exit(1)
|
||||
|
||||
print("discord Token:"+disToken)
|
||||
|
||||
|
||||
init()
|
||||
|
16
autowl/__main__.py
Normal file
16
autowl/__main__.py
Normal file
@ -0,0 +1,16 @@
|
||||
import os
|
||||
import discord
|
||||
|
||||
|
||||
# main runtime function
|
||||
def main():
|
||||
try:
|
||||
disToken = os.environ['DISCORD_TOKEN'] # grabs the discord token from the environment variable, if not there, exit
|
||||
except:
|
||||
print("ERROR: unable to find discord token in environment variables!")
|
||||
exit(1)
|
||||
|
||||
print("hello world")
|
||||
|
||||
|
||||
main()
|
Loading…
Reference in New Issue
Block a user