Skip to content

Instantly share code, notes, and snippets.

@infideleraser
Created October 15, 2018 23:30
Show Gist options
  • Save infideleraser/47ba012593b197948d8c117c67dc60aa to your computer and use it in GitHub Desktop.
Save infideleraser/47ba012593b197948d8c117c67dc60aa to your computer and use it in GitHub Desktop.
import discord
from discord import guild
from discord.ext.commands import bot
from discord.ext import commands
import asyncio
import random
import sys
import os
server = 392138095547645954
james = 434808409754435585
class ModsOnly:
@commands.is_owner()
@commands.command(brief = "changes status of the bot (owner only)")
async def status(self, ctx, statushit):
"""changes status of bot (idle, online, dnd, inv)"""
if statushit == "idle":
await ctx.send("Status changed")
bot.sentinel = 8
while bot.sentinel != 9:
await bot.change_presence(status=discord.Status.idle, activity=discord.Activity(type=2, name=f'{len(bot.users)} users'))
await asyncio.sleep(20)
await bot.change_presence(status=discord.Status.idle, activity=discord.Activity(type=3, name=f'{len(bot.guilds)} servers'))
await asyncio.sleep(30)
if statushit == "dnd":
await ctx.send("Status changed")
bot.sentinel = 8
while bot.sentinel != 9:
await bot.change_presence(status=discord.Status.dnd, activity=discord.Activity(type=2, name=f'{len(bot.users)} users'))
await asyncio.sleep(20)
await bot.change_presence(status=discord.Status.dnd, activity=discord.Activity(type=3, name=f'{len(bot.guilds)} servers'))
await asyncio.sleep(30)
if statushit == "inv":
await ctx.send("Status changed")
bot.sentinel = 8
while bot.sentinel != 9:
await bot.change_presence(status=discord.Status.offline, activity=discord.Activity(type=2, name=f'{len(bot.users)} users'))
await asyncio.sleep(20)
await bot.change_presence(status=discord.Status.offline, activity=discord.Activity(type=3, name=f'{len(bot.guilds)} servers'))
await asyncio.sleep(30)
if statushit == 'online':
await ctx.send("Status changed")
bot.sentinel = 8
while bot.sentinel != 9:
await bot.change_presence(activity=discord.Activity(type=2, name=f'{len(bot.users)} users'))
await asyncio.sleep(20)
await bot.change_presence(activity=discord.Activity(type=3, name=f'{len(bot.guilds)} servers'))
await asyncio.sleep(30)
if statushit not in ("online" ,"idle" , "inv", "dnd"):
await ctx.send(f'"{statushit}" is not a valid parameter. The valid parameters are "online, inv, dnd, idle"')
def setup(bot):
bot.add_cog(ModsOnly())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment