Force LF line endings with gitattributes and convert repo (#52266)

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
jdawg1290
2020-07-15 19:02:40 -05:00
committed by GitHub
parent 39e8bd721f
commit 62676e72a8
1133 changed files with 266492 additions and 266454 deletions

View File

@@ -1,11 +1,11 @@
This is a script to role members in a discord if they have their ckey linked. It should only have to be ran **once**, since the game will handle any other new roles
Requirements:
- Python 3 (Tested on 3.6.4)
- `Mysql-Connector` module
- `Requests` module
How to use:
1. Ensure you have the correct dependencies installed
2. Fill out the config sections in the script (Discord details and SS13 server details)
3. Run the script, and leave it running until its done. It will give progress indicators as it runs
This is a script to role members in a discord if they have their ckey linked. It should only have to be ran **once**, since the game will handle any other new roles
Requirements:
- Python 3 (Tested on 3.6.4)
- `Mysql-Connector` module
- `Requests` module
How to use:
1. Ensure you have the correct dependencies installed
2. Fill out the config sections in the script (Discord details and SS13 server details)
3. Run the script, and leave it running until its done. It will give progress indicators as it runs

View File

@@ -1,59 +1,59 @@
# Script to role discord members who have already associated their BYOND account
# Author: AffectedArc07
# From Discord API:
# Clients are allowed 120 events every 60 seconds, meaning you can send on average at a rate of up to 2 events per second.
# So lets send every 0.6 seconds to ensure we arent rate capped
####### CONFIG ######
# Discord section. Make sure the IDs are strings to avoid issues with IDs that start with a 0
botToken = "Put your discord bot token here"
guildID = "000000000000000000"
roleID = "000000000000000000"
# SS13 Database section
dbHost = "127.0.0.1"
dbUser = "root"
dbPass = "your password here"
dbDatabase = "tg_db"
##### DO NOT TOUCH ANYTHING BELOW HERE UNLESS YOURE FAMILIAR WITH PYTHON #####
import requests, mysql.connector, time
# Connect to DB
dbCon = mysql.connector.connect(
host = dbHost,
user = dbUser,
passwd = dbPass,
database = dbDatabase
)
cur = dbCon.cursor()
# Grab all users who need to be processed
cur.execute("SELECT byond_key, discord_id FROM player WHERE discord_id IS NOT NULL")
usersToProcess = cur.fetchall()
# We dont need the DB anymore, so close it up
dbCon.close()
# Calculate a total for better monitoring
total = len(usersToProcess)
count = 0
print("Found "+str(total)+" accounts to process.")
# Now the actual processing
for user in usersToProcess:
count += 1 # Why the fuck does python not have ++
# user[0] = ckey, user[1] = discord ID
print("Processing "+str(user[0])+" (Discord ID: " + str(user[1]) + ") | User "+str(count)+"/"+str(total))
url = "https://discordapp.com/api/guilds/"+str(guildID)+"/members/"+str(user[1])+"/roles/"+str(roleID)
response = requests.put(url, headers={"Authorization": "Bot "+str(botToken)})
# Adding a role returns a code 204, not a code 200. Dont ask
if response.status_code != 204:
print("WARNING: Returned non-204 status code. Request used: PUT "+str(url))
# Sleep for 0.6. This way we stay under discords rate limiting.
time.sleep(0.6)
# Script to role discord members who have already associated their BYOND account
# Author: AffectedArc07
# From Discord API:
# Clients are allowed 120 events every 60 seconds, meaning you can send on average at a rate of up to 2 events per second.
# So lets send every 0.6 seconds to ensure we arent rate capped
####### CONFIG ######
# Discord section. Make sure the IDs are strings to avoid issues with IDs that start with a 0
botToken = "Put your discord bot token here"
guildID = "000000000000000000"
roleID = "000000000000000000"
# SS13 Database section
dbHost = "127.0.0.1"
dbUser = "root"
dbPass = "your password here"
dbDatabase = "tg_db"
##### DO NOT TOUCH ANYTHING BELOW HERE UNLESS YOURE FAMILIAR WITH PYTHON #####
import requests, mysql.connector, time
# Connect to DB
dbCon = mysql.connector.connect(
host = dbHost,
user = dbUser,
passwd = dbPass,
database = dbDatabase
)
cur = dbCon.cursor()
# Grab all users who need to be processed
cur.execute("SELECT byond_key, discord_id FROM player WHERE discord_id IS NOT NULL")
usersToProcess = cur.fetchall()
# We dont need the DB anymore, so close it up
dbCon.close()
# Calculate a total for better monitoring
total = len(usersToProcess)
count = 0
print("Found "+str(total)+" accounts to process.")
# Now the actual processing
for user in usersToProcess:
count += 1 # Why the fuck does python not have ++
# user[0] = ckey, user[1] = discord ID
print("Processing "+str(user[0])+" (Discord ID: " + str(user[1]) + ") | User "+str(count)+"/"+str(total))
url = "https://discordapp.com/api/guilds/"+str(guildID)+"/members/"+str(user[1])+"/roles/"+str(roleID)
response = requests.put(url, headers={"Authorization": "Bot "+str(botToken)})
# Adding a role returns a code 204, not a code 200. Dont ask
if response.status_code != 204:
print("WARNING: Returned non-204 status code. Request used: PUT "+str(url))
# Sleep for 0.6. This way we stay under discords rate limiting.
time.sleep(0.6)