Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import discord | ||
from discord.ext import commands | ||
from discord.ext.commands import cog | ||
import random | ||
import steam | ||
from steam.ext import commands | ||
import reddit | ||
from steamwebapi import ISteamUser, IPlayerService, ISteamUserStats | ||
|
||
client = commands.bot(command_prefix = '!') | ||
|
||
@client.command() | ||
async def load(ctx, extention): | ||
client.load_extention(f'cogs.{extention}') | ||
|
||
@client.command() | ||
async def unload(ctx, extention): | ||
client.unload_extention(f'cogs.{extention}') | ||
|
||
for filename in os.listdir('./cogs'): | ||
if filename.endswith('.py'): | ||
client.load_extention(f'cogs.{filename[:-3]}') | ||
|
||
@client.event | ||
async def on_ready(): | ||
await client.chage_presence(status=discord.status.idle, activity=discord.game('Hello there')) | ||
print('Bot is ready.') | ||
|
||
@client.event | ||
async def on_command_error(ctx, error): | ||
if isinstance(error, commands.ComamandNotFound): | ||
await ctx.send("please check for missing requirements") | ||
|
||
@client.command() | ||
async def clear(ctx, amount=5): | ||
await ctx.channel.purge(limit=amount) | ||
|
||
@client.event | ||
async def on_member_join(member): | ||
print(F'{member} has joined the server.') | ||
|
||
@client.event | ||
async def on_member_remove(member): | ||
print(F'{member} has left the sever.') | ||
|
||
@client.command() | ||
@is_owner() | ||
async def kill(self, ctx): | ||
try: | ||
self.bot.clear() | ||
await self.bot.close() | ||
except Exception as e: | ||
await ctx.send("Couldn't kill the bot for some reason, maybe this will help:\n" + | ||
F"{type(e)._name_} - {e}") | ||
|
||
@client.command() | ||
@command.cooldown(1, standard_cooldown, command.BucketType.member) | ||
async def floor(self, ctx): | ||
"""Get a random image of a dog or cat.""" | ||
|
||
url = random.choice(["https://some-random-api.ml/img/dog" , "https://some-random-api.ml/img/cat"]) | ||
async with request("GET", url, headers={}) as r: | ||
if r.status !=200: | ||
return await ctx.send(F"The API returned a {r.status} status.") | ||
data = await r.json() | ||
image = data["link"] | ||
|
||
embed = utils.embed_message() | ||
embed.set_image(url=image) | ||
await ctx.send(embed=embed) | ||
|
||
@client.command() | ||
async def hello(ctx): | ||
await ctx.send(F'Sup! {round(client.latency * 1000)}ms') | ||
|
||
@client.command() | ||
async def sosalty(self, ctx): | ||
""""gives you your sosalty number.""" | ||
# random number between 0 and 100 | ||
num1 = random.randrange(100) | ||
print('your saltiness rank is:', num1) | ||
await ctx.send(F'question: {question}\nAnswer: {random.choice(responses)}') | ||
|
||
@client.command(aliases=['8ball']) | ||
async def _8ball(ctx, *, question): | ||
responses = ['it is certain.', | ||
'it is decidedly so.', | ||
'without a doubt.', | ||
'yh yh.', | ||
'keep trying buddy.', | ||
'most likely.', | ||
'major cap.', | ||
'my sources say no.', | ||
'very doubtful.', | ||
'keep trying you will never succeed', | ||
await ctx.send(F'question: {question}\nAnswer: {random.choice(responses)}') | ||
|
||
@client.command(aliases=['Snarky comment']) | ||
async def Snarky(ctx, *, question): | ||
responses = ['wow u noob.' | ||
'cmon grow up.' | ||
'playing games for years and still bad at the game.' | ||
'ngl games dont make you violent, lag does.' | ||
''] | ||
await ctx.send(F'question: {question}/nAnswer: {random.choice(responses)}') | ||
|
||
|
||
# Mention the language keyword | ||
tool = language_check.LanguageTool('en-UK') | ||
i = 0 | ||
|
||
# Path of file which needs to be checked | ||
with open(r'transcript1.txt', 'r') as fin: | ||
|
||
for line in fin: | ||
matches = tool.check(line) | ||
i = i + len(matches) | ||
pass | ||
|
||
# prints total mistakes which are found | ||
# from the document | ||
print("No. of mistakes found in document is ", i) | ||
print() | ||
|
||
# prints mistake one by one | ||
for mistake in matches: | ||
print(mistake) | ||
print() | ||
|
||
api = ISteamUser('https://decapi.me/steam/hours?id=STEAM_ID_HERE&appid=252950') | ||
steamid = api.resolve_vanity_url('profile url') ['response']['steamid'] | ||
summary = api.get_player_summaries(steamid) ['response']['players'][0] | ||
print(summary) | ||
|
||
client.run('P1H5NUweVOGcvem2DlOjDzbw0Wt2USUB') |