This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Gelbpunkt/v3.4-dev
v3.4 dev
- Loading branch information
Showing
207 changed files
with
3,472 additions
and
1,992 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,19 @@ | ||
Please note that IdleRPG is dual-licensed, more information in the README: | ||
https://github.com/Gelbpunkt/IdleRPG/tree/v3.4-dev#license | ||
Below is the brief text of the GNU Affero General Public License. | ||
|
||
The IdleRPG Discord Bot | ||
Copyright (C) 2018-2019 Diniboy and Gelbpunkt | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/> |
Large diffs are not rendered by default.
Oops, something went wrong.
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
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,69 @@ | ||
""" | ||
The IdleRPG Discord Bot | ||
Copyright (C) 2018-2019 Diniboy and Gelbpunkt | ||
This software is dual-licensed under the GNU Affero General Public License for non-commercial and the Travitia License for commercial use. | ||
For more information, see README.md and LICENSE.md. | ||
""" | ||
|
||
|
||
import discord | ||
import datetime | ||
|
||
from discord.ext import commands | ||
|
||
|
||
class Bot(commands.AutoShardedBot): | ||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
|
||
self.launch_time = ( | ||
datetime.datetime.now() | ||
) # we assume the bot is created for use right now | ||
|
||
self.mention_formatter = commands.clean_content() | ||
|
||
@property | ||
def disp(self): | ||
return self.author.display_name | ||
|
||
@property | ||
def uptime(self): | ||
return datetime.datetime.now() - self.launch_time | ||
|
||
async def get_user_global(self, user_id: int): | ||
user = self.get_user(user_id) | ||
if user: | ||
return user | ||
data = await self.cogs["Sharding"].handler("get_user", 1, {"user_id": user_id}) | ||
if not data: | ||
return None | ||
data = data[0] | ||
data["username"] = data["name"] | ||
user = discord.User(state=self._connection, data=data) | ||
self.users.append(user) | ||
return user | ||
|
||
async def reset_cooldown(self, ctx): | ||
await self.redis.execute( | ||
"DEL", f"cd:{ctx.author.id}:{ctx.command.qualified_name}" | ||
) | ||
|
||
async def send_message( | ||
self, | ||
target, | ||
content=None, | ||
*, | ||
escape_mass_mentions=True, | ||
escape_mentions=False, | ||
**fields, | ||
): | ||
if escape_mass_mentions: | ||
content = content.replace("@here", "@\u200bhere").replace( | ||
"@everyone", "@\u200beveryone" | ||
) | ||
if escape_mentions: | ||
# content = await self.mention_formatter.convert(self, content) | ||
pass | ||
|
||
await super(Bot, self).send_message(target, content=content, **fields) |
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,27 @@ | ||
""" | ||
The IdleRPG Discord Bot | ||
Copyright (C) 2018-2019 Diniboy and Gelbpunkt | ||
This software is dual-licensed under the GNU Affero General Public | ||
License for non-commercial and the Travitia License for commercial | ||
use. | ||
For more information, see README.md and LICENSE.md. | ||
""" | ||
|
||
import discord | ||
|
||
from discord.ext import commands | ||
|
||
|
||
class User(commands.Converter): | ||
async def convert(self, ctx, argument): | ||
# TODO: Try the local users first | ||
data = await ctx.bot.cogs["Sharding"].handler( | ||
"fetch_user", 1, {"user_inp": argument} | ||
) | ||
if not data: | ||
raise commands.BadArgument(ctx.message, argument) | ||
data = data[0] | ||
data["username"] = data["name"] | ||
user = discord.User(state=ctx.bot._connection, data=data) | ||
ctx.bot.users.append(user) | ||
return user |
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
Oops, something went wrong.