Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit c9e28d6

Browse files
committed
added commands and events of logging off ,latency ,censoring marco-polo mini game
1 parent 1745fb3 commit c9e28d6

File tree

1 file changed

+84
-33
lines changed

1 file changed

+84
-33
lines changed

Scripts/Bots/DiscordBot/bot.py

+84-33
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,105 @@
11
import discord
22
import os
3-
from discord.ext import commands,tasks
3+
from discord.ext import commands, tasks
44
from itertools import cycle
55
import random
66

77
TOKEN = 'token'
8-
client = commands.Bot(command_prefix = "/")
9-
status = cycle(['Eight arms','Meow meow'])
8+
client = commands.Bot(command_prefix="/")
9+
status = cycle(['Eight arms', 'Meow meow'])
1010
players = {}
1111

12+
cursewords = {
13+
"cursewords": ["fuck",
14+
"fuck off",
15+
"shit", "pissoff",
16+
"dickhead",
17+
"asshole",
18+
"son of a bitch",
19+
"bitch",
20+
"shut the fuck up"]
21+
}
22+
23+
1224
@client.event
1325
async def on_ready():
1426
await client.change_presence(status=discord.Status.dnd, activity=discord.Game('Meow meow'))
1527
print("Bot is online")
1628

29+
1730
@client.event
1831
async def on_member_join(member):
1932
print(f'{member} has joined the server.')
2033

34+
2135
@client.event
2236
async def on_member_remove(member):
2337
print(f'{member} has left the server.')
2438

39+
2540
@client.command()
2641
async def hey_cat(ctx):
2742
await ctx.send("Meow I'm gonna smother you with my tentacles")
2843

44+
2945
@client.command()
3046
async def mc(ctx):
3147
await ctx.send("Life is always hard and on survival until it's not")
3248

33-
@client.command(aliases = ['8arm','check' ])
34-
async def _8arm(ctx,*,question):
35-
responses = [ 'As I see it, yes.',
36-
'Ask again later.'
37-
'Better not tell you now.',
38-
'Cannot predict now.',
39-
'Concentrate and ask again.',
40-
'Don’t count on it.',
41-
'It is certain.',
42-
'It is decidedly so.',
43-
'Most likely.',
44-
'My reply is no.',
45-
'My sources say no.',
46-
'Outlook not so good.',
47-
'Outlook good.',
48-
'Reply hazy, try again.',
49-
'Signs point to yes.',
50-
'Very doubtful.',
51-
'Without a doubt.',
52-
'Yes.',
53-
'Yes – definitely.',
54-
'You may rely on it.']
49+
50+
@client.command(aliases=['8arm', 'check'])
51+
async def _8arm(ctx, *, question):
52+
responses = ['As I see it, yes.',
53+
'Ask again later.'
54+
'Better not tell you now.',
55+
'Cannot predict now.',
56+
'Concentrate and ask again.',
57+
'Don’t count on it.',
58+
'It is certain.',
59+
'It is decidedly so.',
60+
'Most likely.',
61+
'My reply is no.',
62+
'My sources say no.',
63+
'Outlook not so good.',
64+
'Outlook good.',
65+
'Reply hazy, try again.',
66+
'Signs point to yes.',
67+
'Very doubtful.',
68+
'Without a doubt.',
69+
'Yes.',
70+
'Yes – definitely.',
71+
'You may rely on it.']
5572
await ctx.send(f'Question:{question}\nAnswer: {random.choice(responses)}')
5673

74+
5775
@client.event
58-
async def on_command_error(ctx,error):
76+
async def on_command_error(ctx, error):
5977
if isinstance(error, commands.CommandNotFound):
6078
await ctx.send('Unfound tentacles')
6179

80+
6281
@client.command()
63-
@commands.has_permissions(manage_messages = True)
64-
async def clear(ctx, amount = 5):
82+
@commands.has_permissions(manage_messages=True)
83+
async def clear(ctx, amount=5):
6584
await ctx.channel.purge(limit=amount)
6685

67-
async def clear_error(ctx,error):
86+
87+
async def clear_error(ctx, error):
6888
await ctx.send('Please specify the amount of messages to clear with tentacles')
6989

90+
7091
@client.command()
71-
async def load(ctx,extension):
92+
async def load(ctx, extension):
7293
client.load_extension(f'cogs.{extension}')
7394

95+
7496
@client.command()
75-
async def unload(ctx,extension):
97+
async def unload(ctx, extension):
7698
client.unload_extension(f'cogs.{extension}')
7799

100+
78101
@client.command()
79-
async def reload(ctx,extension):
102+
async def reload(ctx, extension):
80103
client.unload_extension(f'cogs.{extension}')
81104
client.load_extension(f'cogs.{extension}')
82105

@@ -85,22 +108,50 @@ async def reload(ctx,extension):
85108
if filename.endswith('.py'):
86109
client.load_extension(f'cogs.{filename[:-3]}')
87110

111+
88112
@tasks.loop(seconds=30)
89113
async def change_status():
90114
await client.change_presence(activity=discord.Game(next(status)))
91115

116+
92117
@client.command(pass_context=True)
93118
async def leave(ctx):
94119
server = ctx.message.server
95120
voice_client = client.voice_client_in(server)
96121
await voice_client.disconnect()
97122

98-
@client.command(pass_context = True)
123+
124+
@client.command(pass_context=True)
99125
async def octoplay(ctx, url):
100126
server = ctx.message.server
101127
voice_client = client.voice_client_in(server)
102128
player = await voice_client.create_ytdl(url)
103129
players[server.id] = player
104130
player.start()
105131

132+
133+
@client.command()
134+
async def marco(ctx):
135+
await ctx.send("polo")
136+
137+
138+
@client.command()
139+
async def logout(ctx):
140+
await ctx.send("Going Offline")
141+
await client.logout()
142+
143+
144+
@client.command()
145+
async def ping(ctx):
146+
await ctx.send(f"pong {round(client.latency *1000)}ms ")
147+
148+
149+
@client.event
150+
async def on_message(message):
151+
if (message.content in cursewords):
152+
153+
await message.channel.purge(limit=1)
154+
await message.author.create_dm()
155+
await message.author.dm_channel.send(f"{message.author.name} that's a strike buddy")
156+
106157
client.run(TOKEN)

0 commit comments

Comments
 (0)