Skip to content

Commit

Permalink
Update bot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno-Neumann authored Jun 8, 2023
1 parent 01b0851 commit 5141f61
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions SCPSL-Discord-Bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import discord
from discord.ext import commands
import requests
import json

Expand All @@ -8,11 +9,6 @@
id = ""
api = ""

#If you have more than 1 server and want this bot to display the other servers change this value.
#1st server = 0, 2nd = 1, 3rd = 2 etc

server = 0

bot = commands.Bot(command_prefix="!", intents=discord.Intents.none())

@bot.event
Expand All @@ -21,7 +17,7 @@ async def on_ready():
while True:
t = requests.get(f"https://api.scpslgame.com/serverinfo.php?id={id}&key={api}&players=true").text
data = json.loads(t)
playercount= data["Servers"][server]["Players"]
playercount= data["Servers"][0]["Players"]
await bot.change_presence(activity=discord.Game(name=playercount))
print(playercount)
await asyncio.sleep(60)
Expand Down

0 comments on commit 5141f61

Please sign in to comment.