Skip to content

Instantly share code, notes, and snippets.

@orels1
Created March 21, 2016 12:42
Show Gist options
  • Save orels1/53fc8f2e335192f1675e to your computer and use it in GitHub Desktop.
Save orels1/53fc8f2e335192f1675e to your computer and use it in GitHub Desktop.
Because we know you always wanted to
###### Idea: irdumb, implementation irdumb and orels1
1. Declare alias for "writecog", which will create a file if it doesn't exist and write to it:
[p]alias add writecog debug (lambda x,y: (lambda x: open("cogs/"+x+".py", 'a'))(x).write(y+"\n"))
where [p] is your bot's prefix
all the data you write with "writecog" will be on the new line
2. Declare alias for "overwritecog", which will create a file if it doesn't exist and overwrite any data if any
[p]alias add overwritecog debug (lambda x,y: (lambda x: open("cogs/"+x+".py", 'w'))(x).write(y+"\n"))
where [p] is your bot's prefix
3. Use those aliases, for example:
[p]=writecog ('cogindiscordtest','import discord\nfrom discord.ext import commands')
where "cogindiscordtest" is the name of your cogfile (.py)
and "discord\nfrom discord.ext import commands" is the code written to the file
bot will return number of sybols written
4. Create a working cog in discord! Be careful, you have to write it correctly in first try, or you'll need to start over
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment