You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

import time
import config
import discord
from discord.ext import commands
class Basic:
def __init__(self, bot): = bot
async def hello(self, ctx):
"""Says hello. Duh."""
await ctx.send(f"Hello {}!")
async def rules(self, ctx, *, targetuser: discord.Member = None):
"""Post a link to the Rules"""
if not targetuser:
targetuser =
await ctx.send(f"{targetuser.mention}: A link to the rules "
f"can be found here: {config.rules_url}")
async def membercount(self, ctx):
"""Prints the member count of the server."""
await ctx.send(f"{} has "
f"{ctx.guild.member_count} members!")
async def source(self, ctx):
"""Gives link to source code."""
await ctx.send("You can find my source at " +
config.source_url +
". Serious PRs and issues welcome!")
@commands.command(aliases=["robocopng", "robocop-ng"])
async def robocop(self, ctx):
"""Shows a quick embed with bot info."""
embed = discord.Embed(title="Robocop-NG",
await ctx.send(embed=embed)
async def ping(self, ctx):
"""Shows ping values to discord.
RTT = Round-trip time, time taken to send a message to discord
GW = Gateway Ping"""
before = time.monotonic()
tmp = await ctx.send('Calculating ping...')
after = time.monotonic()
rtt_ms = (after - before) * 1000
gw_ms = * 1000
message_text = f":ping_pong: rtt: `{rtt_ms:.1f}ms`, `gw: {gw_ms:.1f}ms`"
await tmp.edit(content=message_text)
def setup(bot):