Added rich presence changes

This commit is contained in:
xfnw 2021-11-20 15:59:54 +00:00
parent e79a2b3d0f
commit ce174cefa1

11
bot.py
View file

@ -1,3 +1,5 @@
import discord import discord
from discord import File, Streaming, Game, Activity, ActivityType, Status from discord import File, Streaming, Game, Activity, ActivityType, Status
from discord.ext import commands from discord.ext import commands
@ -12,6 +14,12 @@ foxmsgs = [
'heres ur fox', 'heres ur fox',
] ]
def getAllUsers():
membercount = 0
for guild in bot.guilds:
membercount += guild.member_count
return membercount
async def is_ginlang(ctx): async def is_ginlang(ctx):
""" """
are you ginlang or the other dude? are you ginlang or the other dude?
@ -77,7 +85,7 @@ async def activity(ctx, atype, *, aname):
if atype not in atypes: if atype not in atypes:
await ctx.send("invalid activity type. the valid types are "+' '.join(atypes.keys())) await ctx.send("invalid activity type. the valid types are "+' '.join(atypes.keys()))
return return
await bot.change_presence(activity=Activity(name=aname, type=atypes[atype], url="https://twitch.tv/xginlang")) await bot.change_presence(activity=Activity(name=(aname + f" and foxing {str(getAllUsers())} users"), type=atypes[atype], url="https://twitch.tv/xginlang"))
await ctx.send('Success!') await ctx.send('Success!')
@ -163,6 +171,7 @@ async def on_ready():
await bot.change_presence(activity=Streaming(name="Testing - bot may go offline at any point", url="https://twitch.tv/xginlang")) await bot.change_presence(activity=Streaming(name="Testing - bot may go offline at any point", url="https://twitch.tv/xginlang"))
with open('token.json', 'r') as file: with open('token.json', 'r') as file:
# this breaks if you are on windows
token = ''.join([line[:-1] for line in file.readlines()]) token = ''.join([line[:-1] for line in file.readlines()])
bot.run(token) bot.run(token)