-
Notifications
You must be signed in to change notification settings - Fork 0
/
sans.py
198 lines (165 loc) · 6.33 KB
/
sans.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
print('Loading...')
import subprocess
from inspect import cleandoc
from typing import Union
import os
import discord
from discord.ext import commands
def make_embed(title=None, description=None, author=None, thumbnail=None, url=None, color=None, image=None, name=None) -> discord.Embed:
"""Cleaner way to make embeds
Thumbnail and author are taken as kwargs, title is default "Guide" """
if isinstance(color, int):
color = discord.Color(color)
embed = discord.Embed(
title=title,
color=color,
url=url,
description=description
)
if name is not None: embed.set_author(name=name)
if image is not None: embed.set_image(url=image)
if thumbnail is not None: embed.set_thumbnail(url=thumbnail)
return embed
bot = commands.Bot(command_prefix=("."), case_insensitive=True, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=True))
bot.help_command = commands.DefaultHelpCommand(dm_help=None)
home_path = os.path.dirname(os.path.realpath(__file__)) # previously token_dir
with open(home_path + "/token.json") as tokenfile:
token = tokenfile.read()
@bot.event
async def on_ready():
print('Ready.')
print(f'We have logged in as {bot.user}')
# If you want to be recognised, put your name in
@bot.group()
async def contributors(ctx):
'''Links contributors to the code'''
if ctx.invoked_subcommand is None:
await ctx.send('Which one? Current or old?')
@contributors.command()
async def current(ctx):
'''Lists currect Sans contributors'''
embed = discord.Embed(
title="List of current Sans contributors",
description=cleandoc("""
Meganium97 (Dire) - Current leading coder
Lazr - Removed some useless shit
""")
)
await ctx.send(embed=embed)
@contributors.command()
async def old(ctx):
'''Lists the old Sans contributors'''
embed = discord.Embed(
title="List of old Sans contributors",
description=cleandoc("""
Lazr1026 - Creator and programmer
476MHz (Radeon) - Programmer
Uwuham - Not very much, he makes commits sometimes
Techmuse - PR'd useful shit
Gnome! - Cleaned everything up massively
ItsPizzaTime1501 - Helped with proper licensing
bleck9999 - Fixed Gnomes mistakes
Maretu (ray) - Fixed our terrible grammar
Meganium97 (Dire) - Idk, what are you asking me for?
Glazed_Belmont - Fixed the paths not being universal
""")
)
await ctx.send(embed=embed)
# now onto the actual commands
@bot.command()
async def test(ctx):
'''sends test, what did you expect?'''
await ctx.send('test')
@bot.command()
async def snas(ctx):
'''fortnite battle royale'''
await ctx.send('https://tenor.com/view/sans-undertale-dance-gif-12730380')
@bot.command()
async def sans(ctx):
'''Links the github repo for Sans'''
embed = make_embed(
title="Sans",
author="Maintained by Meganium97",
color=discord.Color.green(),
thumbnail="https://i.imgur.com/AkOLH6q.png",
url="https://github.com/Meganium97/Sans-Remastered",
description="Sans, The discord bot that is kinda useful!"
)
await ctx.send(embed=embed)
@bot.command()
@commands.has_any_role('Owner', 'Staff', 'Admin', 'Sans Contributor')
async def update(ctx):
await ctx.send("Updating code. The bot will be down for a few seconds, if this doesnt break the code.")
subprocess.run(['bash', home_path + '/update.sh'])
@bot.command()
@commands.has_any_role('Owner', 'Staff', 'Admin')
async def ban(ctx, member: discord.User = None, reason="[no reason specified]"):
'''does what it says on the tin'''
if member == None or member == ctx.message.author:
await ctx.channel.send("You cannot ban yourself.")
return
reasonraw = ctx.message.content[28:]
message = f"You have been banned from {ctx.guild.name} for the reason {reasonraw}"
await ctx.guild.ban(member, reason=reasonraw, delete_message_days=0)
await ctx.channel.send(f"{member} has been b&. 👍")
await member.send(message)
@bot.command()
@commands.has_any_role('Owner', 'Staff', 'Admin', 'Helper')
async def kick(ctx, member: discord.Member, *, reason=0):
'''does what it says on the tin'''
await member.kick(reason=reason, delete_message_days=0)
send = f"user {member.name} has been kicked."
await ctx.send(send)
@bot.command()
@commands.has_any_role('Owner', 'Staff', 'Admin', 'Helper', 'Sans Contributor')
async def say(ctx, message):
'''does what it says on the tin (Sans Contributors+)'''
await ctx.message.delete()
await ctx.send(ctx.message.content[5:])
@bot.command(aliases=["pfp"])
async def profile(ctx, user: discord.User):
'''Fetch a user's profile icon'''
await ctx.send(f"Profile image for user: {user.name}")
pfp = user.avatar_url
await ctx.send(pfp)
@bot.command()
async def invite(ctx, invite):
'''Shows the invites for various discord guilds (ivan, homebrew, analog, chill, cave)'''
invites = {
"ivan": "NM85JqJ",
"chill": "eTS6yym",
"analog": "7bXpJSh",
"homebrew": "C29hYvh",
"cave": "XHuCuuwsFN"
}
try: await ctx.send(f"https://discord.gg/{invites[invite.lower()]}")
except: await ctx.send('Options are: ivan, homebrew, analog, chill, cave.')
@bot.command()
async def ping(ctx):
await ctx.send(f':ping_pong: Pong! Latency is {int(bot.latency * 1000)} ms!')
# General fun stuff
@bot.command()
async def bean(ctx, u: discord.Member):
'''BEAN!!!'''
await ctx.send(f"{u.mention} Get Beaned!!!")
@bot.command()
async def suggest(ctx):
'''Suggest a command!'''
await ctx.send('https://forms.gle/boFJXoKG4HcnqvNj6')
@bot.command()
async def magnum(ctx):
'''gun'''
await ctx.send('https://www.halopedia.org/images/7/72/HReach-M6GMagnumPistol-LeftSide.png')
@bot.command()
async def magnum2(ctx):
'''devito moment'''
await ctx.send('dong')
@bot.command()
async def avocadosdemexico(ctx):
'''uhh'''
await ctx.send('https://2.bp.blogspot.com/_9SjeM2Vpk4s/S7LLv3gi08I/AAAAAAAAAUw/41IsMXokTvI/s1600/Avocado.jpg')
@bot.command()
async def triangletraveler(ctx):
'''seriously, ninty?'''
await ctx.send('Triangle traveler? Is that not just octopath traveler?')
bot.run(token)